@matheusbsbs / matheus-bagliano / commits / cbd64afbb3
Fork 0

git-am: Don't accept an mbox on stdin of we already have a .dotest directory

It makes no sense to accept an mbox via stdin when we won't accept it on the commandline. The patch helps the following scenario: # git init-db "add file1 with content" # git checkout -b apply "edit file1 && commit" # git checkout -b conflict master "edit file1 && commit" # git checkout -b ok master "add file2" # git checkout apply # git format-patch -k -3 master..conflict | git am -k -3 => git-am fails with a conflict message # git reset --hard # git format-patch -k -3 master..ok | git am -k -3 => git am fails with the same conflict message as above, => since it's trying to apply the old .dotest directory With the patch it complains about an old .dotest directory instead. Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>

Lukas Sandström committed Jul 19, 2006 at 22:28 UTC cbd64afbb3b1ad5433585ac71d94bd0c63270e38
1 file changed +4 -2
git-am.sh
+4 -2
@@ -156,8 +156,10 @@ fi
156
157 if test -d "$dotest"
158 then
159 - test ",$#," = ",0," ||
160 - die "previous dotest directory $dotest still exists but mbox given."
159 + if test ",$#," != ",0," || ! tty -s
160 + then
161 + die "previous dotest directory $dotest still exists but mbox given."
162 + fi
163 resume=yes
164 else
165 # Make sure we are not given --skip nor --resolved