Skip to content

Commit 619e360

Browse files
johnkeepinggitster
authored andcommitted
rebase: support --no-autostash
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 <[email protected]> Signed-off-by: John Keeping <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 441c4a4 commit 619e360

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

git-rebase.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ git-rebase --continue | --abort | --skip | --edit-todo
1414
Available options are
1515
v,verbose! display a diffstat of what changed upstream
1616
q,quiet! be quiet. implies --no-stat
17-
autostash! automatically stash/stash pop before and after
17+
autostash automatically stash/stash pop before and after
1818
fork-point use 'merge-base --fork-point' to refine upstream
1919
onto=! rebase onto given branch instead of upstream
2020
p,preserve-merges! try to recreate merges instead of ignoring them
@@ -292,6 +292,9 @@ do
292292
--autostash)
293293
autostash=true
294294
;;
295+
--no-autostash)
296+
autostash=false
297+
;;
295298
--verbose)
296299
verbose=t
297300
diffstat=t

t/t3420-rebase-autostash.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ testrebase() {
3737
type=$1
3838
dotest=$2
3939

40+
test_expect_success "rebase$type: dirty worktree, --no-autostash" '
41+
test_config rebase.autostash true &&
42+
git reset --hard &&
43+
git checkout -b rebased-feature-branch feature-branch &&
44+
test_when_finished git branch -D rebased-feature-branch &&
45+
test_when_finished git checkout feature-branch &&
46+
echo dirty >>file3 &&
47+
test_must_fail git rebase$type --no-autostash unrelated-onto-branch
48+
'
49+
4050
test_expect_success "rebase$type: dirty worktree, non-conflicting rebase" '
4151
test_config rebase.autostash true &&
4252
git reset --hard &&

0 commit comments

Comments
 (0)