Merge branch 'hv/autosquash-config'
* hv/autosquash-config: add configuration variable for --autosquash option of interactive rebasemaint
commit
a621859101
|
@ -1549,6 +1549,9 @@ rebase.stat::
|
||||||
Whether to show a diffstat of what changed upstream since the last
|
Whether to show a diffstat of what changed upstream since the last
|
||||||
rebase. False by default.
|
rebase. False by default.
|
||||||
|
|
||||||
|
rebase.autosquash::
|
||||||
|
If set to true enable '--autosquash' option by default.
|
||||||
|
|
||||||
receive.autogc::
|
receive.autogc::
|
||||||
By default, git-receive-pack will run "git-gc --auto" after
|
By default, git-receive-pack will run "git-gc --auto" after
|
||||||
receiving data from git-push and updating refs. You can stop
|
receiving data from git-push and updating refs. You can stop
|
||||||
|
|
|
@ -199,6 +199,9 @@ rebase.stat::
|
||||||
Whether to show a diffstat of what changed upstream since the last
|
Whether to show a diffstat of what changed upstream since the last
|
||||||
rebase. False by default.
|
rebase. False by default.
|
||||||
|
|
||||||
|
rebase.autosquash::
|
||||||
|
If set to true enable '--autosquash' option by default.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
<newbase>::
|
<newbase>::
|
||||||
|
@ -333,6 +336,7 @@ idea unless you know what you are doing (see BUGS below).
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
--autosquash::
|
--autosquash::
|
||||||
|
--no-autosquash::
|
||||||
When the commit log message begins with "squash! ..." (or
|
When the commit log message begins with "squash! ..." (or
|
||||||
"fixup! ..."), and there is a commit whose title begins with
|
"fixup! ..."), and there is a commit whose title begins with
|
||||||
the same ..., automatically modify the todo list of rebase -i
|
the same ..., automatically modify the todo list of rebase -i
|
||||||
|
@ -341,6 +345,10 @@ idea unless you know what you are doing (see BUGS below).
|
||||||
commit from `pick` to `squash` (or `fixup`).
|
commit from `pick` to `squash` (or `fixup`).
|
||||||
+
|
+
|
||||||
This option is only valid when the '--interactive' option is used.
|
This option is only valid when the '--interactive' option is used.
|
||||||
|
+
|
||||||
|
If the '--autosquash' option is enabled by default using the
|
||||||
|
configuration variable `rebase.autosquash`, this option can be
|
||||||
|
used to override and disable this setting.
|
||||||
|
|
||||||
--no-ff::
|
--no-ff::
|
||||||
With --interactive, cherry-pick all rebased commits instead of
|
With --interactive, cherry-pick all rebased commits instead of
|
||||||
|
|
|
@ -111,6 +111,7 @@ VERBOSE=
|
||||||
OK_TO_SKIP_PRE_REBASE=
|
OK_TO_SKIP_PRE_REBASE=
|
||||||
REBASE_ROOT=
|
REBASE_ROOT=
|
||||||
AUTOSQUASH=
|
AUTOSQUASH=
|
||||||
|
test "$(git config --bool rebase.autosquash)" = "true" && AUTOSQUASH=t
|
||||||
NEVER_FF=
|
NEVER_FF=
|
||||||
|
|
||||||
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
|
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
|
||||||
|
@ -831,6 +832,9 @@ first and then run 'git rebase --continue' again."
|
||||||
--autosquash)
|
--autosquash)
|
||||||
AUTOSQUASH=t
|
AUTOSQUASH=t
|
||||||
;;
|
;;
|
||||||
|
--no-autosquash)
|
||||||
|
AUTOSQUASH=
|
||||||
|
;;
|
||||||
--onto)
|
--onto)
|
||||||
shift
|
shift
|
||||||
ONTO=$(parse_onto "$1") ||
|
ONTO=$(parse_onto "$1") ||
|
||||||
|
|
|
@ -21,38 +21,62 @@ test_expect_success setup '
|
||||||
git tag base
|
git tag base
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'auto fixup' '
|
test_auto_fixup() {
|
||||||
git reset --hard base &&
|
git reset --hard base &&
|
||||||
echo 1 >file1 &&
|
echo 1 >file1 &&
|
||||||
git add -u &&
|
git add -u &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -m "fixup! first"
|
git commit -m "fixup! first"
|
||||||
|
|
||||||
git tag final-fixup &&
|
git tag $1 &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git rebase --autosquash -i HEAD^^^ &&
|
git rebase $2 -i HEAD^^^ &&
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test 3 = $(wc -l <actual) &&
|
test 3 = $(wc -l <actual) &&
|
||||||
git diff --exit-code final-fixup &&
|
git diff --exit-code $1 &&
|
||||||
test 1 = "$(git cat-file blob HEAD^:file1)" &&
|
test 1 = "$(git cat-file blob HEAD^:file1)" &&
|
||||||
test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
|
test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
|
||||||
|
}
|
||||||
|
|
||||||
|
test_expect_success 'auto fixup (option)' '
|
||||||
|
test_auto_fixup final-fixup-option --autosquash
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'auto squash' '
|
test_expect_success 'auto fixup (config)' '
|
||||||
|
git config rebase.autosquash true &&
|
||||||
|
test_auto_fixup final-fixup-config-true &&
|
||||||
|
test_must_fail test_auto_fixup fixup-config-true-no --no-autosquash &&
|
||||||
|
git config rebase.autosquash false &&
|
||||||
|
test_must_fail test_auto_fixup final-fixup-config-false
|
||||||
|
'
|
||||||
|
|
||||||
|
test_auto_squash() {
|
||||||
git reset --hard base &&
|
git reset --hard base &&
|
||||||
echo 1 >file1 &&
|
echo 1 >file1 &&
|
||||||
git add -u &&
|
git add -u &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -m "squash! first"
|
git commit -m "squash! first"
|
||||||
|
|
||||||
git tag final-squash &&
|
git tag $1 &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git rebase --autosquash -i HEAD^^^ &&
|
git rebase $2 -i HEAD^^^ &&
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test 3 = $(wc -l <actual) &&
|
test 3 = $(wc -l <actual) &&
|
||||||
git diff --exit-code final-squash &&
|
git diff --exit-code $1 &&
|
||||||
test 1 = "$(git cat-file blob HEAD^:file1)" &&
|
test 1 = "$(git cat-file blob HEAD^:file1)" &&
|
||||||
test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
|
test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
|
||||||
|
}
|
||||||
|
|
||||||
|
test_expect_success 'auto squash (option)' '
|
||||||
|
test_auto_squash final-squash --autosquash
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'auto squash (config)' '
|
||||||
|
git config rebase.autosquash true &&
|
||||||
|
test_auto_squash final-squash-config-true &&
|
||||||
|
test_must_fail test_auto_squash squash-config-true-no --no-autosquash &&
|
||||||
|
git config rebase.autosquash false &&
|
||||||
|
test_must_fail test_auto_squash final-squash-config-false
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'misspelled auto squash' '
|
test_expect_success 'misspelled auto squash' '
|
||||||
|
|
Loading…
Reference in New Issue