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

[PATCH 1/2] rebase: support --no-autostash

From
John Keeping <john@keeping.me.uk>
Date
Sep 10, 2015, 22:30 UTC
Message-ID
<549b3289ee263b25a241c823444a99420e5a8bfb.1441924193.git.john@keeping.me.uk>
In-Reply-To
<cover.1441924193.git.john@keeping.me.uk>

This is documented as an option but we don't actually accept it. Support it so that it is possible to override the "rebase.autostash" config variable.

Reported-by: Daniel Hahler <genml+git-2014@thequod.de>
Signed-off-by: John Keeping <john@keeping.me.uk>
---
 git-rebase.sh               |  5 ++++-
 t/t3420-rebase-autostash.sh | 10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 1757404..af7ba5f 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -14,7 +14,7 @@ git-rebase --continue | --abort | --skip | --edit-todo
  Available options are
 v,verbose!         display a diffstat of what changed upstream
 q,quiet!           be quiet. implies --no-stat
-autostash!         automatically stash/stash pop before and after
+autostash          automatically stash/stash pop before and after
 fork-point         use 'merge-base --fork-point' to refine upstream
 onto=!             rebase onto given branch instead of upstream
 p,preserve-merges! try to recreate merges instead of ignoring them
@@ -292,6 +292,9 @@ do
 	--autostash)
 		autostash=true
 		;;
+	--no-autostash)
+		autostash=false
+		;;
 	--verbose)
 		verbose=t
 		diffstat=t
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index d783f03..944154b 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -37,6 +37,16 @@ testrebase() {
 	type=$1
 	dotest=$2
 
+	test_expect_success "rebase$type: dirty worktree, --no-autostash" '
+		test_config rebase.autostash true &&
+		git reset --hard &&
+		git checkout -b rebased-feature-branch feature-branch &&
+		test_when_finished git branch -D rebased-feature-branch &&
+		test_when_finished git checkout feature-branch &&
+		echo dirty >>file3 &&
+		test_must_fail git rebase$type --no-autostash unrelated-onto-branch
+	'
+
 	test_expect_success "rebase$type: dirty worktree, non-conflicting rebase" '
 		test_config rebase.autostash true &&
 		git reset --hard &&
-- 
2.6.0.rc0.162.gb2d3693
Previous: John KeepingNext: John Keeping
Message 3 of 5 in “Bug: "git rebase --no-autostash" not recognized”
  1. Daniel HahlerSep 10, 2015
  2. 0/2 rebase: support --no-autostashJohn Keeping, Sep 10, 2015
  3. 1/2 rebase: support --no-autostashJohn Keeping, Sep 10, 2015
  4. 2/2 Documentation/git-rebase: fix --no-autostash formattingJohn Keeping, Sep 10, 2015
  5. Matthieu MoySep 11, 2015

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.