Skip to content

Commit

Permalink
Fix merge-one-file for our-side-added/our-side-removed cases
Browse files Browse the repository at this point in the history
When commit ed93b44 changed the script so that it does not
touch untracked working tree file, we forgot that we still
needed to resolve the index entry (otherwise they are left
unmerged).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jul 9, 2007
1 parent a734291 commit 561b0fb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git-merge-one-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ case "${1:-.}${2:-.}${3:-.}" in
# read-tree checked that index matches HEAD already,
# so we know we do not have this path tracked.
# there may be an unrelated working tree file here,
# which we should just leave unmolested.
exit 0
# which we should just leave unmolested. Make sure
# we do not have it in the index, though.
exec git update-index --remove -- "$4"
fi
if test -f "$4"; then
rm -f -- "$4" &&
Expand All @@ -42,15 +43,16 @@ case "${1:-.}${2:-.}${3:-.}" in
#
".$2.")
# the other side did not add and we added so there is nothing
# to be done.
# to be done, except making the path merged.
exec git update-index --add --cacheinfo "$6" "$2" "$4"
;;
"..$3")
echo "Adding $4"
test -f "$4" || {
echo "ERROR: untracked $4 is overwritten by the merge."
exit 1
}
git update-index --add --cacheinfo "$6$7" "$2$3" "$4" &&
git update-index --add --cacheinfo "$7" "$3" "$4" &&
exec git checkout-index -u -f -- "$4"
;;

Expand Down

0 comments on commit 561b0fb

Please sign in to comment.