mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
git-merge-one-file: fix longstanding stupid thinko
When a merge result creates a new file, and when our side already has a file in the path, taking the merge result may clobber the untracked file. However, the logic to detect this situation was totally the wrong way. We should complain when the file exists, not when the file does not exist. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -48,10 +48,11 @@ case "${1:-.}${2:-.}${3:-.}" in
|
||||
;;
|
||||
"..$3")
|
||||
echo "Adding $4"
|
||||
test -f "$4" || {
|
||||
if test -f "$4"
|
||||
then
|
||||
echo "ERROR: untracked $4 is overwritten by the merge."
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
git update-index --add --cacheinfo "$7" "$3" "$4" &&
|
||||
exec git checkout-index -u -f -- "$4"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user