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

[PATCH 3/3] rebase: finish_rebase() in noop rebase

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jun 13, 2013, 16:06 UTC
Message-ID
<1371139573-28047-4-git-send-email-artagnon@gmail.com>
In-Reply-To
<1371139573-28047-1-git-send-email-artagnon@gmail.com>
In the following case
  $ git rebase master
  Current branch autostash-fix is up to date.

the autostash is not applied automatically, because this codepath forgets to call finish_rebase(). Fix this. Also add a test to guard against regressions.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 git-rebase.sh               |  1 +
 t/t3420-rebase-autostash.sh | 11 +++++++++++
 2 files changed, 12 insertions(+)
diff --git a/git-rebase.sh b/git-rebase.sh
index 154d4be..2d5c2bd 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -547,6 +547,7 @@ then
 		# Lazily switch to the target branch if needed...
 		test -z "$switch_to" || git checkout "$switch_to" --
 		say "$(eval_gettext "Current branch \$branch_name is up to date.")"
+		finish_rebase
 		exit 0
 	else
 		say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 1bde007..90eb264 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -152,6 +152,17 @@ test_expect_success "rebase: fast-forward rebase" '
 	git checkout feature-branch
 '
 
+test_expect_success "rebase: noop rebase" '
+	test_config rebase.autostash true &&
+	git reset --hard &&
+	git checkout -b same-feature-branch feature-branch &&
+	test_when_finished git branch -D same-feature-branch &&
+	echo dirty >>file1 &&
+	git rebase feature-branch &&
+	grep dirty file1 &&
+	git checkout feature-branch
+'
+
 testrebase "" .git/rebase-apply
 testrebase " --merge" .git/rebase-merge
 testrebase " --interactive" .git/rebase-merge
-- 
1.8.3.1.381.gf08dd97.dirty
Previous: Ramkumar Ramachandra
Message 7 of 7 in “Fix a couple of edge cases in autostash”
  1. 0/3 Fix a couple of edge cases in autostashRamkumar Ramachandra, Jun 13, 2013
  2. 1/3 rebase: guard against missing files in read_basic_state()Ramkumar Ramachandra, Jun 13, 2013
  3. Junio C HamanoJun 13, 2013
  4. Martin von ZweigbergkJun 16, 2013
  5. Junio C HamanoJun 20, 2013
  6. 2/3 rebase: finish_rebase() in fast-forward rebaseRamkumar Ramachandra, Jun 13, 2013
  7. 3/3 rebase: finish_rebase() in noop rebaseRamkumar Ramachandra, Jun 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.