Skip to content

Commit

Permalink
traverse_trees_recursive(): propagate merge errors up
Browse files Browse the repository at this point in the history
There were few places where merge errors detected deeper in the call chain
were ignored and not propagated up the callchain to the caller.

Most notably, this caused switching branches with "git checkout" to ignore
a path modified in a work tree are different between the HEAD version and
the commit being switched to, which it internally notices but ignores it,
resulting in an incorrect two-way merge and loss of the change in the work
tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Mar 10, 2008
1 parent 1caeacc commit 542c264
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions unpack-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conf
sha1 = names[i].sha1;
fill_tree_descriptor(t+i, sha1);
}
traverse_trees(n, t, &newinfo);
return 0;
return traverse_trees(n, t, &newinfo);
}

/*
Expand Down Expand Up @@ -306,7 +305,9 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
if (src[0])
conflicts |= 1;
}
traverse_trees_recursive(n, dirmask, conflicts, names, info);
if (traverse_trees_recursive(n, dirmask, conflicts,
names, info) < 0)
return -1;
return mask;
}

Expand Down

0 comments on commit 542c264

Please sign in to comment.