From: Brian Lyles <brianmlyles@gmail.com>
To: git@vger.kernel.org
Cc: Brian Lyles <brianmlyles@gmail.com>,
newren@gmail.com, me@ttaylorr.com, phillip.wood123@gmail.com,
gitster@pobox.com
Subject: [PATCH v2 3/8] rebase: update `--empty=ask` to `--empty=drop`
Date: Sat, 10 Feb 2024 01:43:51 -0600 [thread overview]
Message-ID: <20240210074859.552497-4-brianmlyles@gmail.com> (raw)
In-Reply-To: <20240119060721.3734775-2-brianmlyles@gmail.com>
When git-am(1) got its own `--empty` option in 7c096b8d61 (am: support
--empty=<option> to handle empty patches, 2021-12-09), `stop` was used
instead of `ask`. `stop` is a more accurate term for describing what
really happens, and consistency is good.
Update git-rebase(1) to also use `stop`, while keeping `ask` as a
deprecated synonym. Update the tests to primarily use `stop`, but also
ensure that `ask` is still allowed.
In a future commit, we'll be adding a new `--empty` option for
git-cherry-pick(1) as well, making the consistency even more relevant.
Signed-off-by: Brian Lyles <brianmlyles@gmail.com>
Reported-by: Elijah Newren <newren@gmail.com>
---
Documentation/git-rebase.txt | 15 ++++++++-------
builtin/rebase.c | 16 ++++++++++------
t/t3424-rebase-empty.sh | 21 ++++++++++++++++-----
3 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 68cdebd2aa..6f64084a95 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -289,23 +289,24 @@ See also INCOMPATIBLE OPTIONS below.
+
See also INCOMPATIBLE OPTIONS below.
---empty=(ask|drop|keep)::
+--empty=(drop|keep|stop)::
How to handle commits that are not empty to start and are not
clean cherry-picks of any upstream commit, but which become
empty after rebasing (because they contain a subset of already
upstream changes):
+
--
-`ask`;;
- The rebase will halt when the commit is applied, allowing you to
- choose whether to drop it, edit files more, or just commit the empty
- changes. This option is implied when `-i`/`--interactive` is
- specified.
`drop`;;
The commit will be dropped. This is the default behavior.
`keep`;;
The commit will be kept. This option is implied when `--exec` is
specified unless `-i`/`--interactive` is also specified.
+`stop`;;
+`ask`;;
+ The rebase will halt when the commit is applied, allowing you to
+ choose whether to drop it, edit files more, or just commit the empty
+ changes. This option is implied when `-i`/`--interactive` is
+ specified. `ask` is a deprecated synonym of `stop`.
--
+
Note that commits which start empty are kept (unless `--no-keep-empty`
@@ -705,7 +706,7 @@ be dropped automatically with `--no-keep-empty`).
Similar to the apply backend, by default the merge backend drops
commits that become empty unless `-i`/`--interactive` is specified (in
which case it stops and asks the user what to do). The merge backend
-also has an `--empty=(ask|drop|keep)` option for changing the behavior
+also has an `--empty=(drop|keep|stop)` option for changing the behavior
of handling commits that become empty.
Directory rename detection
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 4084a6abb8..3b9bb2fa06 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -58,7 +58,7 @@ enum empty_type {
EMPTY_UNSPECIFIED = -1,
EMPTY_DROP,
EMPTY_KEEP,
- EMPTY_ASK
+ EMPTY_STOP
};
enum action {
@@ -954,10 +954,14 @@ static enum empty_type parse_empty_value(const char *value)
return EMPTY_DROP;
else if (!strcasecmp(value, "keep"))
return EMPTY_KEEP;
- else if (!strcasecmp(value, "ask"))
- return EMPTY_ASK;
+ else if (!strcasecmp(value, "stop"))
+ return EMPTY_STOP;
+ else if (!strcasecmp(value, "ask")) {
+ warning(_("--empty=ask is deprecated; use '--empty=stop' instead."));
+ return EMPTY_STOP;
+ }
- die(_("unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask\"."), value);
+ die(_("unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"stop\"."), value);
}
static int parse_opt_keep_empty(const struct option *opt, const char *arg,
@@ -1136,7 +1140,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
"instead of ignoring them"),
1, PARSE_OPT_HIDDEN),
OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
- OPT_CALLBACK_F(0, "empty", &options, "(drop|keep|ask)",
+ OPT_CALLBACK_F(0, "empty", &options, "(drop|keep|stop)",
N_("how to handle commits that become empty"),
PARSE_OPT_NONEG, parse_opt_empty),
OPT_CALLBACK_F('k', "keep-empty", &options, NULL,
@@ -1553,7 +1557,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (options.empty == EMPTY_UNSPECIFIED) {
if (options.flags & REBASE_INTERACTIVE_EXPLICIT)
- options.empty = EMPTY_ASK;
+ options.empty = EMPTY_STOP;
else if (options.exec.nr > 0)
options.empty = EMPTY_KEEP;
else
diff --git a/t/t3424-rebase-empty.sh b/t/t3424-rebase-empty.sh
index 73ff35ced2..1ee6b00fd5 100755
--- a/t/t3424-rebase-empty.sh
+++ b/t/t3424-rebase-empty.sh
@@ -72,6 +72,17 @@ test_expect_success 'rebase --merge --empty=keep' '
test_cmp expect actual
'
+test_expect_success 'rebase --merge --empty=stop' '
+ git checkout -B testing localmods &&
+ test_must_fail git rebase --merge --empty=stop upstream &&
+
+ git rebase --skip &&
+
+ test_write_lines D C B A >expect &&
+ git log --format=%s >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'rebase --merge --empty=ask' '
git checkout -B testing localmods &&
test_must_fail git rebase --merge --empty=ask upstream &&
@@ -101,9 +112,9 @@ test_expect_success 'rebase --interactive --empty=keep' '
test_cmp expect actual
'
-test_expect_success 'rebase --interactive --empty=ask' '
+test_expect_success 'rebase --interactive --empty=stop' '
git checkout -B testing localmods &&
- test_must_fail git rebase --interactive --empty=ask upstream &&
+ test_must_fail git rebase --interactive --empty=stop upstream &&
git rebase --skip &&
@@ -112,7 +123,7 @@ test_expect_success 'rebase --interactive --empty=ask' '
test_cmp expect actual
'
-test_expect_success 'rebase --interactive uses default of --empty=ask' '
+test_expect_success 'rebase --interactive uses default of --empty=stop' '
git checkout -B testing localmods &&
test_must_fail git rebase --interactive upstream &&
@@ -194,9 +205,9 @@ test_expect_success 'rebase --exec uses default of --empty=keep' '
test_cmp expect actual
'
-test_expect_success 'rebase --exec --empty=ask' '
+test_expect_success 'rebase --exec --empty=stop' '
git checkout -B testing localmods &&
- test_must_fail git rebase --exec "true" --empty=ask upstream &&
+ test_must_fail git rebase --exec "true" --empty=stop upstream &&
git rebase --skip &&
--
2.43.0
next prev parent reply other threads:[~2024-02-10 7:49 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 5:59 [PATCH 1/4] sequencer: Do not require `allow_empty` for redundant commit options brianmlyles
2024-01-19 5:59 ` [PATCH 2/4] docs: Clean up `--empty` formatting in `git-rebase` and `git-am` brianmlyles
2024-01-23 14:24 ` Phillip Wood
2024-01-27 21:22 ` Brian Lyles
2024-02-01 14:02 ` Phillip Wood
2024-01-19 5:59 ` [PATCH 3/4] rebase: Update `--empty=ask` to `--empty=drop` brianmlyles
2024-01-23 14:24 ` Phillip Wood
2024-01-27 21:49 ` Brian Lyles
2024-02-01 14:02 ` Phillip Wood
2024-01-19 5:59 ` [PATCH 4/4] cherry-pick: Add `--empty` for more robust redundant commit handling brianmlyles
2024-01-20 20:24 ` Kristoffer Haugsbakk
2024-01-21 18:28 ` Brian Lyles
2024-01-21 22:05 ` Kristoffer Haugsbakk
2024-01-21 22:41 ` Junio C Hamano
2024-01-22 10:40 ` Phillip Wood
2024-01-22 20:55 ` Kristoffer Haugsbakk
2024-01-23 5:23 ` Brian Lyles
2024-01-23 7:11 ` Kristoffer Haugsbakk
2024-01-23 17:32 ` Junio C Hamano
2024-01-23 18:41 ` Subject: [PATCH] CoC: whitespace fix Junio C Hamano
2024-01-24 3:06 ` Elijah Newren
2024-01-23 18:49 ` [PATCH 4/4] cherry-pick: Add `--empty` for more robust redundant commit handling Junio C Hamano
2024-01-23 14:25 ` Phillip Wood
2024-01-23 18:01 ` Junio C Hamano
2024-01-28 0:07 ` Brian Lyles
2024-01-27 23:56 ` Brian Lyles
2024-01-20 21:38 ` [PATCH 1/4] sequencer: Do not require `allow_empty` for redundant commit options Kristoffer Haugsbakk
2024-01-21 18:19 ` Brian Lyles
2024-01-23 14:23 ` Phillip Wood
2024-01-23 18:18 ` Junio C Hamano
2024-01-24 11:01 ` Phillip Wood
2024-01-24 11:01 ` Phillip Wood
2024-01-27 23:30 ` Brian Lyles
2024-01-28 16:36 ` Brian Lyles
2024-01-29 10:55 ` Phillip Wood
2024-02-10 5:50 ` Brian Lyles
2024-02-01 10:57 ` Phillip Wood
2024-02-10 4:34 ` Brian Lyles
2024-02-10 7:43 ` [PATCH v2 0/8] cherry-pick: add `--empty` Brian Lyles
2024-02-22 16:39 ` phillip.wood123
2024-02-10 7:43 ` [PATCH v2 1/8] docs: address inaccurate `--empty` default with `--exec` Brian Lyles
2024-02-10 7:43 ` [PATCH v2 2/8] docs: clean up `--empty` formatting in git-rebase(1) and git-am(1) Brian Lyles
2024-02-10 7:43 ` Brian Lyles [this message]
2024-02-11 4:54 ` [PATCH v2 3/8] rebase: update `--empty=ask` to `--empty=drop` Brian Lyles
2024-02-14 11:05 ` Phillip Wood
2024-02-22 16:34 ` phillip.wood123
2024-02-22 18:27 ` Junio C Hamano
2024-02-10 7:43 ` [PATCH v2 4/8] sequencer: treat error reading HEAD as unborn branch Brian Lyles
2024-02-22 16:34 ` phillip.wood123
2024-02-23 5:28 ` Brian Lyles
2024-02-25 16:57 ` phillip.wood123
2024-02-10 7:43 ` [PATCH v2 5/8] sequencer: do not require `allow_empty` for redundant commit options Brian Lyles
2024-02-22 16:35 ` phillip.wood123
2024-02-10 7:43 ` [PATCH v2 6/8] cherry-pick: decouple `--allow-empty` and `--keep-redundant-commits` Brian Lyles
2024-02-22 16:35 ` Phillip Wood
2024-02-22 18:41 ` Junio C Hamano
2024-02-10 7:43 ` [PATCH v2 7/8] cherry-pick: enforce `--keep-redundant-commits` incompatibility Brian Lyles
2024-02-22 16:35 ` Phillip Wood
2024-02-23 6:23 ` Brian Lyles
2024-02-23 17:41 ` Junio C Hamano
2024-02-25 16:58 ` phillip.wood123
2024-02-26 3:04 ` Brian Lyles
2024-02-10 7:43 ` [PATCH v2 8/8] cherry-pick: add `--empty` for more robust redundant commit handling Brian Lyles
2024-02-11 20:50 ` Jean-Noël AVILA
2024-02-12 1:35 ` Brian Lyles
2024-02-22 16:36 ` phillip.wood123
2024-02-23 6:58 ` Brian Lyles
2024-02-25 16:57 ` phillip.wood123
2024-02-26 2:21 ` Brian Lyles
2024-02-26 3:32 ` Brian Lyles
2024-02-27 10:39 ` phillip.wood123
2024-02-27 17:33 ` Junio C Hamano
2024-03-10 18:41 ` [PATCH v3 0/7] " Brian Lyles
2024-03-13 16:12 ` phillip.wood123
2024-03-10 18:42 ` [PATCH v3 1/7] docs: address inaccurate `--empty` default with `--exec` Brian Lyles
2024-03-10 18:42 ` [PATCH v3 2/7] docs: clean up `--empty` formatting in git-rebase(1) and git-am(1) Brian Lyles
2024-03-10 18:42 ` [PATCH v3 3/7] rebase: update `--empty=ask` to `--empty=stop` Brian Lyles
2024-03-10 18:42 ` [PATCH v3 4/7] sequencer: treat error reading HEAD as unborn branch Brian Lyles
2024-03-11 0:07 ` Junio C Hamano
2024-03-11 16:54 ` Junio C Hamano
2024-03-12 2:04 ` Brian Lyles
2024-03-12 22:25 ` Junio C Hamano
2024-03-16 3:05 ` Brian Lyles
2024-03-13 15:10 ` phillip.wood123
2024-03-16 3:07 ` Brian Lyles
2024-03-10 18:42 ` [PATCH v3 5/7] sequencer: do not require `allow_empty` for redundant commit options Brian Lyles
2024-03-10 18:42 ` [PATCH v3 6/7] cherry-pick: enforce `--keep-redundant-commits` incompatibility Brian Lyles
2024-03-10 18:42 ` [PATCH v3 7/7] cherry-pick: add `--empty` for more robust redundant commit handling Brian Lyles
2024-03-13 16:10 ` phillip.wood123
2024-03-13 17:17 ` Junio C Hamano
2024-03-16 5:20 ` Brian Lyles
2024-03-20 19:35 ` phillip.wood123
2024-03-20 23:36 ` [PATCH v4 0/7] " Brian Lyles
2024-03-25 14:38 ` phillip.wood123
2024-03-25 16:12 ` Brian Lyles
2024-03-25 19:36 ` phillip.wood123
2024-03-25 20:57 ` Junio C Hamano
2024-03-20 23:36 ` [PATCH v4 1/7] docs: address inaccurate `--empty` default with `--exec` Brian Lyles
2024-03-20 23:36 ` [PATCH v4 2/7] docs: clean up `--empty` formatting in git-rebase(1) and git-am(1) Brian Lyles
2024-03-20 23:36 ` [PATCH v4 3/7] rebase: update `--empty=ask` to `--empty=stop` Brian Lyles
2024-03-20 23:36 ` [PATCH v4 4/7] sequencer: handle unborn branch with `--allow-empty` Brian Lyles
2024-03-21 9:52 ` Dirk Gouders
2024-03-21 16:22 ` Junio C Hamano
2024-03-21 19:45 ` Dirk Gouders
2024-03-20 23:37 ` [PATCH v4 5/7] sequencer: do not require `allow_empty` for redundant commit options Brian Lyles
2024-03-20 23:37 ` [PATCH v4 6/7] cherry-pick: enforce `--keep-redundant-commits` incompatibility Brian Lyles
2024-03-20 23:37 ` [PATCH v4 7/7] cherry-pick: add `--empty` for more robust redundant commit handling Brian Lyles
2024-03-25 23:16 ` [PATCH v5 0/7] " Brian Lyles
2024-03-26 14:45 ` phillip.wood123
2024-03-26 18:28 ` Junio C Hamano
2024-03-27 16:37 ` phillip.wood123
2024-03-25 23:16 ` [PATCH v5 1/7] docs: address inaccurate `--empty` default with `--exec` Brian Lyles
2024-03-25 23:16 ` [PATCH v5 2/7] docs: clean up `--empty` formatting in git-rebase(1) and git-am(1) Brian Lyles
2024-03-25 23:16 ` [PATCH v5 3/7] rebase: update `--empty=ask` to `--empty=stop` Brian Lyles
2024-03-25 23:16 ` [PATCH v5 4/7] sequencer: handle unborn branch with `--allow-empty` Brian Lyles
2024-03-25 23:16 ` [PATCH v5 5/7] sequencer: do not require `allow_empty` for redundant commit options Brian Lyles
2024-03-25 23:16 ` [PATCH v5 6/7] cherry-pick: enforce `--keep-redundant-commits` incompatibility Brian Lyles
2024-03-25 23:16 ` [PATCH v5 7/7] cherry-pick: add `--empty` for more robust redundant commit handling Brian Lyles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240210074859.552497-4-brianmlyles@gmail.com \
--to=brianmlyles@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).