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

[PATCH 1/2] built-in rebase: demonstrate regression with --autostash

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 7, 2018, 14:00 UTC
Message-ID
<9a5237b13bb22e192cbe5777e6338d78e0773bad.1541599246.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.70.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

An unnamed colleague of Ævar Arnfjörð Bjarmason reported a breakage where a `pull --rebase` (which did not really need to do anything but stash, see that nothing was changed, and apply the stash again) also detached the HEAD.

This patch adds a minimal reproducer for this regression.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3420-rebase-autostash.sh | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index f355c6825a..d4e2520bcb 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -361,4 +361,12 @@ test_expect_success 'autostash with dirty submodules' '
 	git rebase -i --autostash HEAD
 '
 
+test_expect_failure 'branch is left alone when possible' '
+	git checkout -b unchanged-branch &&
+	echo changed >file0 &&
+	git rebase --autostash unchanged-branch &&
+	test changed = "$(cat file0)" &&
+	test unchanged-branch = "$(git rev-parse --abbrev-ref HEAD)"
+'
+
 test_done
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 2 of 4 in “built-in rebase --autostash: fix regression”
  1. 0/2 built-in rebase --autostash: fix regressionJohannes Schindelin via GitGitGadget, Nov 7, 2018
  2. 1/2 built-in rebase: demonstrate regression with --autostashJohannes Schindelin via GitGitGadget, Nov 7, 2018
  3. 2/2 built-in rebase --autostash: leave the current branch alone if possibleJohannes Schindelin via GitGitGadget, Nov 7, 2018
  4. Jeff KingNov 7, 2018

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.