Fix merge-one-file for our-side-added/our-side-removed cases
When commit ed93b449 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>
Junio C Hamano committed
Jul 8, 2007 at 14:42 UTC
561b0fbb4a2d336faeb929380bddd6ec420d7b11
1 file changed
+6
-4
git-merge-one-file.sh
+6
-4
@@ -27,8 +27,9 @@ case "${1:-.}${2:-.}${3:-.}" in
27
# read-tree checked that index matches HEAD already,
28
# so we know we do not have this path tracked.
29
# there may be an unrelated working tree file here,
30
- # which we should just leave unmolested.
31
- exit 0
30
+ # which we should just leave unmolested. Make sure
31
+ # we do not have it in the index, though.
32
+ exec git update-index --remove -- "$4"
33
fi
34
if test -f "$4"; then
35
rm -f -- "$4" &&
@@ -42,7 +43,8 @@ case "${1:-.}${2:-.}${3:-.}" in
43
#
44
".$2.")
45
# the other side did not add and we added so there is nothing
45
- # to be done.
46
+ # to be done, except making the path merged.
47
+ exec git update-index --add --cacheinfo "$6" "$2" "$4"
48
;;
49
"..$3")
50
echo "Adding $4"
@@ -50,7 +52,7 @@ case "${1:-.}${2:-.}${3:-.}" in
52
echo "ERROR: untracked $4 is overwritten by the merge."
53
exit 1
54
}
53
- git update-index --add --cacheinfo "$6$7" "$2$3" "$4" &&
55
+ git update-index --add --cacheinfo "$7" "$3" "$4" &&
56
exec git checkout-index -u -f -- "$4"
57
;;
58