Skip to content

Commit

Permalink
git-am: Don't accept an mbox on stdin of we already have a .dotest di…
Browse files Browse the repository at this point in the history
…rectory

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>
  • Loading branch information
Lukas Sandström authored and Junio C Hamano committed Jul 24, 2006
1 parent f8263c5 commit cbd64af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ fi

if test -d "$dotest"
then
test ",$#," = ",0," ||
die "previous dotest directory $dotest still exists but mbox given."
if test ",$#," != ",0," || ! tty -s
then
die "previous dotest directory $dotest still exists but mbox given."
fi
resume=yes
else
# Make sure we are not given --skip nor --resolved
Expand Down

0 comments on commit cbd64af

Please sign in to comment.