git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory
@ 2006-07-19 20:28 Lukas Sandström
  2006-07-20 14:33 ` Petr Baudis
  0 siblings, 1 reply; 3+ messages in thread
From: Lukas Sandström @ 2006-07-19 20:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory
  2006-07-19 20:28 [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory Lukas Sandström
@ 2006-07-20 14:33 ` Petr Baudis
  2006-07-20 19:35   ` Lukas Sandström
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Baudis @ 2006-07-20 14:33 UTC (permalink / raw)
  To: Lukas Sandström; +Cc: Junio C Hamano, Git Mailing List

Dear diary, on Wed, Jul 19, 2006 at 10:28:00PM CEST, I got a letter
where Lukas Sandström <lukass@etek.chalmers.se> said that...
> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
> ---

Please don't be afraid of putting stuff to commit message. It can only
improve things. :-)

> # 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.

I think this rather means that git reset --hard should clear the .dotest
directory, or something (perhaps just warn)...

> -	test ",$#," = ",0," ||
> +	if test ",$#," != ",0," || ! tty -s

...but this looks like a horrible idea. Does this mean that git-am can't
be now ran without a terminal? (E.g. in a cron/at job, inside a procmail
rule etc.) That's bad.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory
  2006-07-20 14:33 ` Petr Baudis
@ 2006-07-20 19:35   ` Lukas Sandström
  0 siblings, 0 replies; 3+ messages in thread
From: Lukas Sandström @ 2006-07-20 19:35 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Junio C Hamano, Git Mailing List

Petr Baudis wrote:
> Dear diary, on Wed, Jul 19, 2006 at 10:28:00PM CEST, I got a letter
> where Lukas Sandström <lukass@etek.chalmers.se> said that...
>> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
>> ---
> 
> Please don't be afraid of putting stuff to commit message. It can only
> improve things. :-)
> 
>> # 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.
> 
> I think this rather means that git reset --hard should clear the .dotest
> directory, or something (perhaps just warn)...

But the .dotest directory is user-selectable in git-am.

> 
>> -	test ",$#," = ",0," ||
>> +	if test ",$#," != ",0," || ! tty -s
> 
> ...but this looks like a horrible idea. Does this mean that git-am can't
> be now ran without a terminal? (E.g. in a cron/at job, inside a procmail
> rule etc.) That's bad.
> 

This would only stop it from running without a terminal if you have an old
.dotest directory lying around, ie. you already have a failed am-session.
git-am wouldn't work in this case before either, all the patch does is to
give a better error-message.

/Lukas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-20 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-19 20:28 [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory Lukas Sandström
2006-07-20 14:33 ` Petr Baudis
2006-07-20 19:35   ` Lukas Sandström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).