git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin
@ 2009-01-28  2:38 Jay Soffian
  2009-01-28  2:38 ` [PATCH 2/2] git-am: minor cleanups Jay Soffian
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jay Soffian @ 2009-01-28  2:38 UTC (permalink / raw)
  To: git; +Cc: Jay Soffian, gitster, sverre

When git am is called w/o arguments, w/o a patch on stdin and the user hits
ctrl-c, it leaves behind a partially populated $dotest directory. After this
commit, it emits usage when called w/o arguments and w/o a patch on stdin.

Also ensure that $dotest is cleaned up if user manages to interupt mailsplit
while it is processing input.

Noticed by Sverre Rabbelier
---
 git-am.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index b1c05c9..36227c6 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -254,10 +254,10 @@ else
 		done
 		shift
 	fi
-	git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" ||  {
-		rm -fr "$dotest"
-		exit 1
-	}
+	test $# = 0 && test -t 0 && usage
+	trap 'rm -fr "$dotest"' 0
+	git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" || exit 1
+	trap - 0
 
 	# -s, -u, -k, --whitespace, -3, -C and -p flags are kept
 	# for the resuming session after a patch failure.
-- 
1.6.1.224.gb56c

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

end of thread, other threads:[~2009-01-28  3:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-28  2:38 [PATCH 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin Jay Soffian
2009-01-28  2:38 ` [PATCH 2/2] git-am: minor cleanups Jay Soffian
2009-01-28  2:53 ` [PATCH 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin Jay Soffian
2009-01-28  3:01 ` Junio C Hamano
2009-01-28  3:08   ` Jay Soffian

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