git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 5/8] am: return control to caller, for housekeeping
Date: Fri, 10 May 2013 19:56:42 +0530	[thread overview]
Message-ID: <1368196005-5354-6-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1368196005-5354-1-git-send-email-artagnon@gmail.com>

We only need to do these two tasks

    git gc --auto
    rm -fr "$dotest"

ourselves if the script was invoked as a standalone program; when
invoked with --rebasing (from git-rebase--am.sh), cascade control back
to the ultimate caller git-rebase.sh to do this for us.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 git-am.sh         | 9 +++++++--
 git-rebase--am.sh | 8 ++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index f4ef8fc..47c1021 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -904,5 +904,10 @@ if test -s "$dotest"/rewritten; then
     fi
 fi
 
-rm -fr "$dotest"
-git gc --auto
+# If am was called with --rebasing (from git-rebase--am), it's up to
+# the caller to take care of housekeeping.
+if ! test -f "$dotest/rebasing"
+then
+	rm -fr "$dotest"
+	git gc --auto
+fi
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index f84854f..34e3102 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -7,12 +7,12 @@ case "$action" in
 continue)
 	git am --resolved --resolvemsg="$resolvemsg" &&
 	move_to_original_branch
-	exit
+	return
 	;;
 skip)
 	git am --skip --resolvemsg="$resolvemsg" &&
 	move_to_original_branch
-	exit
+	return
 	;;
 esac
 
@@ -56,7 +56,7 @@ else
 
 		As a result, git cannot rebase them.
 		EOF
-		exit $?
+		return $?
 	fi
 
 	git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches"
@@ -68,7 +68,7 @@ fi
 if test 0 != $ret
 then
 	test -d "$state_dir" && write_basic_state
-	exit $ret
+	return $ret
 fi
 
 move_to_original_branch
-- 
1.8.3.rc1.52.gc14258d

  parent reply	other threads:[~2013-05-10 14:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 14:26 [PATCH v2 0/8] rebase.autostash completed Ramkumar Ramachandra
2013-05-10 14:26 ` [PATCH 1/8] am: suppress error output from a conditional Ramkumar Ramachandra
2013-05-10 14:46   ` Junio C Hamano
2013-05-11 23:38     ` Ramkumar Ramachandra
2013-05-12  3:09       ` Junio C Hamano
2013-05-10 14:26 ` [PATCH 2/8] rebase -i: don't error out if $state_dir already exists Ramkumar Ramachandra
2013-05-10 14:26 ` [PATCH 3/8] am: tighten a conditional that checks for $dotest Ramkumar Ramachandra
2013-05-10 14:26 ` [PATCH 4/8] rebase: prepare to do generic housekeeping Ramkumar Ramachandra
2013-05-10 14:33   ` Eric Sunshine
2013-05-10 15:18     ` Junio C Hamano
2013-05-10 15:32   ` Junio C Hamano
2013-05-10 16:39     ` Ramkumar Ramachandra
2013-05-10 14:26 ` Ramkumar Ramachandra [this message]
2013-05-10 14:26 ` [PATCH 6/8] rebase -i: return control to caller, for housekeeping Ramkumar Ramachandra
2013-05-10 14:26 ` [PATCH 7/8] rebase --merge: " Ramkumar Ramachandra
2013-05-10 14:26 ` [PATCH 8/8] rebase: implement --[no-]autostash and rebase.autostash Ramkumar Ramachandra
2013-05-10 14:41   ` Eric Sunshine
2013-05-10 15:29   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368196005-5354-6-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).