int any_dirs = 0;
char *cache_name;
int ce_stage;
+ int skip_entry = 0;
/* Find the first name in the input. */
any_files = 1;
src[0] = active_cache[o->pos];
remove = o->pos;
+ if (o->skip_unmerged && ce_stage(src[0]))
+ skip_entry = 1;
}
for (i = 0; i < len; i++) {
continue;
}
+ if (skip_entry) {
+ subposns[i] = df_conflict_list;
+ posns[i] = posns[i]->next;
+ continue;
+ }
+
if (!o->merge)
ce_stage = 0;
else if (i + 1 < o->head_idx)
posns[i] = posns[i]->next;
}
if (any_files) {
- if (o->merge) {
+ if (skip_entry) {
+ o->pos++;
+ while (o->pos < active_nr &&
+ !strcmp(active_cache[o->pos]->name,
+ src[0]->name))
+ o->pos++;
+ } else if (o->merge) {
int ret;
#if DBRT_DEBUG > 1
}
static struct checkout state;
-static void check_updates(struct cache_entry **src, int nr,
- struct unpack_trees_options *o)
+static void check_updates(struct unpack_trees_options *o)
{
unsigned cnt = 0, total = 0;
struct progress *progress = NULL;
char last_symlink[PATH_MAX];
+ int i;
if (o->update && o->verbose_update) {
- for (total = cnt = 0; cnt < nr; cnt++) {
- struct cache_entry *ce = src[cnt];
+ for (total = cnt = 0; cnt < active_nr; cnt++) {
+ struct cache_entry *ce = active_cache[cnt];
if (ce->ce_flags & (CE_UPDATE | CE_REMOVE))
total++;
}
}
*last_symlink = '\0';
- while (nr--) {
- struct cache_entry *ce = *src++;
+ for (i = 0; i < active_nr; i++) {
+ struct cache_entry *ce = active_cache[i];
if (ce->ce_flags & (CE_UPDATE | CE_REMOVE))
display_progress(progress, ++cnt);
if (ce->ce_flags & CE_REMOVE) {
if (o->update)
unlink_entry(ce->name, last_symlink);
+ remove_cache_entry_at(i);
+ i--;
continue;
}
if (ce->ce_flags & CE_UPDATE) {
error("Merge requires file-level merging");
}
- check_updates(active_cache, active_nr, o);
+ check_updates(o);
return 0;
}
* If we have an entry in the index cache, then we want to
* make sure that it matches head.
*/
- if (index && !same(index, head)) {
+ if (index && !same(index, head))
return o->gently ? -1 : reject_merge(index);
- }
if (head) {
/* #5ALT, #15 */