diff options
author | Elijah Newren <newren@gmail.com> | 2020-04-11 02:44:25 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-11 14:15:52 -0700 |
commit | b9cbd2958f235614e9af687691c96bb001945f86 (patch) | |
tree | 1c115ceab03da1b3ba814c7ee5fe6b9b6be7ed43 /t/t3421-rebase-topology-linear.sh | |
parent | 1b5735f75c7fd5a46a86adce35d1ed0c6e00ee0f (diff) | |
download | git-b9cbd2958f235614e9af687691c96bb001945f86.tar.gz |
rebase: reinstate --no-keep-empty
Commit d48e5e21da ("rebase (interactive-backend): make --keep-empty the
default", 2020-02-15) turned --keep-empty (for keeping commits which
start empty) into the default. The logic underpinning that commit was:
1) 'git commit' errors out on the creation of empty commits without an
override flag
2) Once someone determines that the override is worthwhile, it's
annoying and/or harmful to required them to take extra steps in
order to keep such commits around (and to repeat such steps with
every rebase).
While the logic on which the decision was made is sound, the result was
a bit of an overcorrection. Instead of jumping to having --keep-empty
being the default, it jumped to making --keep-empty the only available
behavior. There was a simple workaround, though, which was thought to
be good enough at the time. People could still drop commits which
started empty the same way the could drop any commits: by firing up an
interactive rebase and picking out the commits they didn't want from the
list. However, there are cases where external tools might create enough
empty commits that picking all of them out is painful. As such, having
a flag to automatically remove start-empty commits may be beneficial.
Provide users a way to drop commits which start empty using a flag that
existed for years: --no-keep-empty. Interpret --keep-empty as
countermanding any previous --no-keep-empty, but otherwise leaving
--keep-empty as the default.
This might lead to some slight weirdness since commands like
git rebase --empty=drop --keep-empty
git rebase --empty=keep --no-keep-empty
look really weird despite making perfect sense (the first will drop
commits which become empty, but keep commits that started empty; the
second will keep commits which become empty, but drop commits which
started empty). However, --no-keep-empty was named years ago and we are
predominantly keeping it for backward compatibility; also we suspect it
will only be used rarely since folks already have a simple way to drop
commits they don't want with an interactive rebase.
Reported-by: Bryan Turner <bturner@atlassian.com>
Reported-by: Sami Boukortt <sami@boukortt.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3421-rebase-topology-linear.sh')
-rwxr-xr-x | t/t3421-rebase-topology-linear.sh | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh index cf8dfd6c20..4a9204b4b6 100755 --- a/t/t3421-rebase-topology-linear.sh +++ b/t/t3421-rebase-topology-linear.sh @@ -220,14 +220,13 @@ test_have_prereq !REBASE_P || test_run_rebase failure -p test_run_rebase () { result=$1 shift - test_expect_$result "rebase $* --keep-empty" " + test_expect_$result "rebase $* --no-keep-empty drops begin-empty commits" " reset_rebase && - git rebase $* --keep-empty c l && - test_cmp_rev c HEAD~3 && - test_linear_range 'd k l' c.. + git rebase $* --no-keep-empty c l && + test_cmp_rev c HEAD~2 && + test_linear_range 'd l' c.. " } -test_run_rebase success --apply test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p @@ -242,7 +241,6 @@ test_run_rebase () { test_linear_range 'd k l' j.. " } -test_run_rebase success --apply test_run_rebase success -m test_run_rebase success -i test_have_prereq !REBASE_P || test_run_rebase success -p |