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

[PATCH 3/7] rebase: prepare to do generic housekeeping

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
May 12, 2013, 11:56 UTC
Message-ID
<1368359801-28121-4-git-send-email-artagnon@gmail.com>
In-Reply-To
<1368359801-28121-1-git-send-email-artagnon@gmail.com>

On successful completion of a rebase in git-rebase--$backend.sh, the $backend script cleans up on its own and exits. The cleanup routine is however, independent of the $backend, and each $backend script unnecessarily duplicates this work:

    rm -rf "$state_dir"
    git gc --auto

Prepare git-rebase.sh for later patches that return control from each $backend script back to us, for performing this generic cleanup routine. The code that this patch adds is currently unreachable, and will only start to be used when git-rebase--$backend.sh scripts are taught to return control in later patches.

Another advantage is that git-rebase.sh can implement a generic finish_rebase() to possibly do additional tasks in addition to the cleanup.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 git-rebase.sh | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/git-rebase.sh b/git-rebase.sh
index 2c692c3..f8b533d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -150,6 +150,13 @@ run_specific_rebase () {
 		autosquash=
 	fi
 	. git-rebase--$type
+	ret=$?
+	if test $ret -eq 0
+	then
+		git gc --auto &&
+		rm -rf "$state_dir"
+	fi
+	exit $ret
 }
 
 run_pre_rebase_hook () {
-- 
1.8.3.rc1.51.gd7a04de
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 4 of 22 in “rebase.autostash completed”
  1. 0/7 rebase.autostash completedRamkumar Ramachandra, May 12, 2013
  2. 1/7 am: tighten a conditional that checks for $dotestRamkumar Ramachandra, May 12, 2013
  3. 2/7 rebase -i: don't error out if $state_dir already existsRamkumar Ramachandra, May 12, 2013
  4. 3/7 rebase: prepare to do generic housekeepingRamkumar Ramachandra, May 12, 2013
  5. 4/7 am: return control to caller, for housekeepingRamkumar Ramachandra, May 12, 2013
  6. 5/7 rebase -i: return control to caller, for housekeepingRamkumar Ramachandra, May 12, 2013
  7. 6/7 rebase --merge: return control to caller, for housekeepingRamkumar Ramachandra, May 12, 2013
  8. 7/7 rebase: implement --[no-]autostash and rebase.autostashRamkumar Ramachandra, May 12, 2013
  9. Junio C HamanoMay 13, 2013
  10. Ramkumar RamachandraMay 13, 2013
  11. Junio C HamanoMay 13, 2013
  12. Ramkumar RamachandraMay 13, 2013
  13. Matthieu MoyMay 13, 2013
  14. Ramkumar RamachandraMay 13, 2013
  15. Matthieu MoyMay 13, 2013
  16. Junio C HamanoMay 13, 2013
  17. Ramkumar RamachandraMay 13, 2013
  18. Matthieu MoyMay 13, 2013
  19. Junio C HamanoMay 13, 2013
  20. Junio C HamanoMay 13, 2013
  21. Ramkumar RamachandraMay 13, 2013
  22. Junio C HamanoMay 13, 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.