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

[PATCH 5/8] am: return control to caller, for housekeeping

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
May 10, 2013, 14:26 UTC
Message-ID
<1368196005-5354-6-git-send-email-artagnon@gmail.com>
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
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 13 of 18 in “rebase.autostash completed”
  1. 0/8 rebase.autostash completedRamkumar Ramachandra, May 10, 2013
  2. 1/8 am: suppress error output from a conditionalRamkumar Ramachandra, May 10, 2013
  3. Junio C HamanoMay 10, 2013
  4. Ramkumar RamachandraMay 11, 2013
  5. Junio C HamanoMay 12, 2013
  6. 2/8 rebase -i: don't error out if $state_dir already existsRamkumar Ramachandra, May 10, 2013
  7. 3/8 am: tighten a conditional that checks for $dotestRamkumar Ramachandra, May 10, 2013
  8. 4/8 rebase: prepare to do generic housekeepingRamkumar Ramachandra, May 10, 2013
  9. Eric SunshineMay 10, 2013
  10. Junio C HamanoMay 10, 2013
  11. Junio C HamanoMay 10, 2013
  12. Ramkumar RamachandraMay 10, 2013
  13. 5/8 am: return control to caller, for housekeepingRamkumar Ramachandra, May 10, 2013
  14. 6/8 rebase -i: return control to caller, for housekeepingRamkumar Ramachandra, May 10, 2013
  15. 7/8 rebase --merge: return control to caller, for housekeepingRamkumar Ramachandra, May 10, 2013
  16. 8/8 rebase: implement --[no-]autostash and rebase.autostashRamkumar Ramachandra, May 10, 2013
  17. Eric SunshineMay 10, 2013
  18. Junio C HamanoMay 10, 2013

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.