posns[i] = create_tree_entry_list(t+i);
if (unpack_trees_rec(posns, len, o->prefix ? o->prefix : "",
- o, &df_conflict_list))
+ o, &df_conflict_list)) {
+ if (o->gently) {
+ discard_cache();
+ read_cache();
+ }
return -1;
+ }
}
- if (o->trivial_merges_only && o->nontrivial_merge)
- return error("Merge requires file-level merging");
+ if (o->trivial_merges_only && o->nontrivial_merge) {
+ if (o->gently) {
+ discard_cache();
+ read_cache();
+ }
+ return o->gently ? -1 :
+ error("Merge requires file-level merging");
+ }
check_updates(active_cache, active_nr, o);
return 0;
}
if (errno == ENOENT)
return 0;
- return error("Entry '%s' not uptodate. Cannot merge.", ce->name);
+ return o->gently ? -1 :
+ error("Entry '%s' not uptodate. Cannot merge.", ce->name);
}
static void invalidate_ce_path(struct cache_entry *ce)
d.exclude_per_dir = o->dir->exclude_per_dir;
i = read_directory(&d, ce->name, pathbuf, namelen+1, NULL);
if (i)
- return error("Updating '%s' would lose untracked files in it",
- ce->name);
+ return o->gently ? -1 :
+ error("Updating '%s' would lose untracked files in it",
+ ce->name);
free(pathbuf);
return cnt;
}
return 0;
}
- return error("Untracked working tree file '%s' "
- "would be %s by merge.", ce->name, action);
+ return o->gently ? -1 :
+ error("Untracked working tree file '%s' "
+ "would be %s by merge.", ce->name, action);
}
return 0;
}
/* #14, #14ALT, #2ALT */
if (remote && !df_conflict_head && head_match && !remote_match) {
if (index && !same(index, remote) && !same(index, head))
- return reject_merge(index);
+ return o->gently ? -1 : reject_merge(index);
return merged_entry(remote, index, o);
}
/*
* make sure that it matches head.
*/
if (index && !same(index, head)) {
- return reject_merge(index);
+ return o->gently ? -1 : reject_merge(index);
}
if (head) {
/* all other failures */
remove_entry(remove);
if (oldtree)
- return reject_merge(oldtree);
+ return o->gently ? -1 : reject_merge(oldtree);
if (current)
- return reject_merge(current);
+ return o->gently ? -1 : reject_merge(current);
if (newtree)
- return reject_merge(newtree);
+ return o->gently ? -1 : reject_merge(newtree);
return -1;
}
}
return error("Cannot do a bind merge of %d trees\n",
o->merge_size);
if (a && old)
- return error("Entry '%s' overlaps. Cannot bind.", a->name);
+ return o->gently ? -1 :
+ error("Entry '%s' overlaps. Cannot bind.", a->name);
if (!a)
return keep_entry(old, o);
else