git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Lukas Sandström <lukass@etek.chalmers.se>
Date
Jul 19, 2006, 20:28 UTC
Message-ID
<44BE95D0.9090708@etek.chalmers.se>
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
---

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.

 git-am.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 3a129e0..04f0119 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -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
-- 
1.4.1.g59817
Next: Petr Baudis
Message 1 of 3 in “git-am: Don't accept an mbox on stdin of we already have a .dotest directory”
  1. git-am: Don't accept an mbox on stdin of we already have a .dotest directoryLukas Sandström, Jul 19, 2006
  2. Petr BaudisJul 20, 2006
  3. Lukas SandströmJul 20, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.