Skip to contentSkip to conversation

Die preserve ggg

PATCH Superseded Philip Oakley via GitGitGadget 5 participants 35 messages May 26, 2022 – Jun 11, 2022

lore
Share & tools
lore
#0 lore raw

cover Die preserve ggg

This short series is a follow up to GitGitGadget "Update the die() preserve-merges messages to help some users (PR #1155)" [1].

The first patch is a tidy up of the --preserve option to highlight that it is now Deleted, rather than Deprecated.

In response to Avar's comments that the former error message merely 'tantilised without telling' the user what to do, it became obvious that the underling problem was that the user was unable to git rebase --abort which was also fatal, when a preserve-rebase was in progress.

Thus the main update is to allow the rebase --abort command, even when a --preserve is in progress, to proceed. The --abort code was unchanged by the removal of the preserve option, as the resetting and clean up of internal state is common to the other rebase options.

The user facing fatal message now simply advises to abort, or downgrade to a version that has preserve-merges to complete the rebase.

The final patch highlights that some IDEs still allow the setting of the preserve-merges option as a pull config setup.

Philip Oakly

[1] GitLore ref [email protected]
https://lore.kernel.org/git/[email protected]/

Philip Oakley (3):
rebase.c: state preserve-merges has been removed
rebase: help users when dying with preserve-merges
rebase: note preserve merges may be a pull config option

 builtin/rebase.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

base-commit: c4f0e309ae745751d08727f24e8ff55e56355755
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1242%2FPhilipOakley%2Fdie_preserve_ggg-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1242/PhilipOakley/die_preserve_ggg-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1242

Signature · 1 line
gitgitgadget
#1 lore raw

PATCH 1/3 rebase.c: state preserve-merges has been removed

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix the option tip.

---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/rebase.c +1 -1
index 7ab50cda2ad..6ce7e98a6f1 100644
@@ -1110,7 +1110,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 			parse_opt_interactive),
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
Signature · 1 line
gitgitgadget
#13 lore raw

PATCH 2/3 rebase: help users when dying with `preserve-merges`

In reply to Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

Git will die if a "rebase --preserve-merges" is in progress. Users cannot --quit, --abort or --continue the rebase.

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

One trigger was an unexpectedly difficult to resolve conflict, as reported on the git-users group.
(https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM)

Tell the user the options to resolve the problem manually.

---
 builtin/rebase.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
builtin/rebase.c +4 -2
index 6ce7e98a6f1..aada25a8870 100644
@@ -1182,8 +1182,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	} else if (is_directory(merge_dir())) {
 		strbuf_reset(&buf);
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
-		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+		if (is_directory(buf.buf) && !(action == ACTION_ABORT)) {
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"Use `git rebase --abort` to terminate current rebase.\n"
+			"Or downgrade to v2.33, or earlier, to complete the rebase.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
Signature · 1 line
gitgitgadget
#19 lore raw

PATCH 3/3 rebase: note `preserve` merges may be a pull config option

In reply to Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.35.0. However users may not be aware that it is also a Pull option, and it is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the use of the preserve option in the pull config.

---
 builtin/rebase.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
builtin/rebase.c +2 -1
index aada25a8870..6fc0aaebbb8 100644
@@ -1205,7 +1205,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Your `pull` configuration, may also invoke this option."));
 
 	if (action != ACTION_NONE && total_argc != 2) {
 		usage_with_options(builtin_rebase_usage,
Signature · 1 line
gitgitgadget
#2 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to Philip Oakley via GitGitGadget
Quoted 17 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix the option tip.

---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/rebase.c +0 -0
index 7ab50cda2ad..6ce7e98a6f1 100644

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 8 lines
builtin/rebase.c +1 -1
@@ -1110,7 +1110,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 			parse_opt_interactive),
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

I have some local patches for this more generally, but for PARSE_OPT_HIDDEN options we never do anything with the "argh" field, i.e. it's only used for showing the "git <cmd> -h" output, and if it's hidden it won't be there.

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

This series shouldn't fix the general issue (which parse-options.c should really be BUG()-ing about, after fixing the existing occurances. But For this one we could just set this to have a string of "" or something, only the string you're changing in 3/3 will be seen by anyone.

#14 lore raw

Re: [PATCH 2/3] rebase: help users when dying with `preserve-merges`

In reply to Philip Oakley via GitGitGadget
Quoted 27 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

Git will die if a "rebase --preserve-merges" is in progress. Users cannot --quit, --abort or --continue the rebase.

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

One trigger was an unexpectedly difficult to resolve conflict, as reported on the git-users group.
(https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM)

Tell the user the options to resolve the problem manually.

---
 builtin/rebase.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
builtin/rebase.c +0 -0
index 6ce7e98a6f1..aada25a8870 100644
@@ -1182,8 +1182,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	} else if (is_directory(merge_dir())) {
 		strbuf_reset(&buf);

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1191

Quoted 10 lines
builtin/rebase.c +4 -2
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
-		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+		if (is_directory(buf.buf) && !(action == ACTION_ABORT)) {
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"Use `git rebase --abort` to terminate current rebase.\n"
+			"Or downgrade to v2.33, or earlier, to complete the rebase.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());

Existing issue: No _(), shouldn't we add it?

I wonder if we should use die_message() + advise() in these cases, i.e. stick to why we died in die_message() and have the advise() make suggestions, as e4921d877ab (tracking branches: add advice to ambiguous refspec error, 2022-04-01) does.

But then again adding new advice is currently a bit of an excercise in boilerplate, and this seems fine for a transitory option.

I think you don't need to add a trailing \n though...

#20 lore raw

Re: [PATCH 3/3] rebase: note `preserve` merges may be a pull config option

In reply to Philip Oakley via GitGitGadget
Quoted 19 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.35.0. However users may not be aware that it is also a Pull option, and it is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the use of the preserve option in the pull config.

---
 builtin/rebase.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
builtin/rebase.c +0 -0
index aada25a8870..6fc0aaebbb8 100644

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1212

Quoted 9 lines
builtin/rebase.c +2 -1
@@ -1205,7 +1205,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Your `pull` configuration, may also invoke this option."));
 
 	if (action != ACTION_NONE && total_argc != 2) {
 		usage_with_options(builtin_rebase_usage,

Ditto 2/3 about maybe die_message() + advise(). In this case that has the slight advantace of allowing us to keep the existing translated string as-is.

But also, is *our* pull configuration causing us to end up here? I vaguely recall that being discussed (probably in answer to a question of mine) in the earlier round, or is this the IDE picking it up & invoking us like this?

#24 lore raw
In reply to Philip Oakley via GitGitGadget
Quoted 10 lines · Philip Oakley via GitGitGadget

This short series is a follow up to GitGitGadget "Update the die() preserve-merges messages to help some users (PR #1155)" [1].

The first patch is a tidy up of the --preserve option to highlight that it is now Deleted, rather than Deprecated.

In response to Avar's comments that the former error message merely 'tantilised without telling' the user what to do, it became obvious that the underling problem was that the user was unable to git rebase --abort which was also fatal, when a preserve-rebase was in progress.

Thanks a lot for following up on this, this all looks OK to me. I had some minor comments about maybe tweaking this & that, but as far as I'm concerned this could go in as-is, depending on whether you think it needs a re-roll in response to my comments + others.

#3 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to Ævar Arnfjörð Bjarmason
Quoted 32 lines · Ævar Arnfjörð Bjarmason
Quoted 17 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix the option tip.

---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/rebase.c +0 -0
index 7ab50cda2ad..6ce7e98a6f1 100644

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 8 lines
builtin/rebase.c +1 -1
@@ -1110,7 +1110,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 			parse_opt_interactive),
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

I have some local patches for this more generally, but for PARSE_OPT_HIDDEN options we never do anything with the "argh" field, i.e. it's only used for showing the "git <cmd> -h" output, and if it's hidden it won't be there.

Quoted 2 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

I still think it's useful for those that read the code, as it reminds folks about what it is/was, and why it's hidden, hence the usefulness of the change, from my perspective. I'm flexible either way, but didn't feel the 'DEPRECATED' was correct information.

Quoted 6 lines

This series shouldn't fix the general issue (which parse-options.c should really be BUG()-ing about, after fixing the existing occurances. But For this one we could just set this to have a string of "" or something, only the string you're changing in 3/3 will be seen by anyone.

#15 lore raw

Re: [PATCH 2/3] rebase: help users when dying with `preserve-merges`

In reply to Ævar Arnfjörð Bjarmason
Quoted 32 lines · Ævar Arnfjörð Bjarmason
Quoted 30 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

Git will die if a "rebase --preserve-merges" is in progress. Users cannot --quit, --abort or --continue the rebase.

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

One trigger was an unexpectedly difficult to resolve conflict, as reported on the git-users group.
(https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM)

Tell the user the options to resolve the problem manually.

---
 builtin/rebase.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
builtin/rebase.c +0 -2
index 6ce7e98a6f1..aada25a8870 100644
@@ -1182,8 +1182,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	} else if (is_directory(merge_dir())) {
 		strbuf_reset(&buf);
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
-		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
Quoted 8 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1191

Quoted 7 lines
builtin/rebase.c +4 -0
+		if (is_directory(buf.buf) && !(action == ACTION_ABORT)) {
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"Use `git rebase --abort` to terminate current rebase.\n"
+			"Or downgrade to v2.33, or earlier, to complete the rebase.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());

Existing issue: No _(), shouldn't we add it?

This strbuf_addf is forming a path for internal use. It just happens to look like legible English ;-)

Quoted 5 lines

I wonder if we should use die_message() + advise() in these cases, i.e. stick to why we died in die_message() and have the advise() make suggestions, as e4921d877ab (tracking branches: add advice to ambiguous refspec error, 2022-04-01) does.

Ah, maybe it's my message.. that needs translating.

Quoted 3 lines

But then again adding new advice is currently a bit of an excercise in boilerplate, and this seems fine for a transitory option.

I can go with that ;-)

Quoted 2 lines

I think you don't need to add a trailing \n though...

Oops, just a little extra line spacing for emphasis maybe ?

#21 lore raw

Re: [PATCH 3/3] rebase: note `preserve` merges may be a pull config option

In reply to Ævar Arnfjörð Bjarmason

hi,

Quoted 23 lines · Ævar Arnfjörð Bjarmason
Quoted 21 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.35.0. However users may not be aware that it is also a Pull option, and it is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the use of the preserve option in the pull config.

---
 builtin/rebase.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
builtin/rebase.c +0 -0
index aada25a8870..6fc0aaebbb8 100644
@@ -1205,7 +1205,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
Quoted 8 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1212

Quoted 7 lines
builtin/rebase.c +2 -1
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Your `pull` configuration, may also invoke this option."));
 
 	if (action != ACTION_NONE && total_argc != 2) {
 		usage_with_options(builtin_rebase_usage,

Ditto 2/3 about maybe die_message() + advise().

I'm not that enamoured about hiding die message details behind an advice option. In this case it not meant to be a regular reminder type thing, rather a one-off fix-it-forever sort of `advice'. At least that my reasoning.

Quoted 5 lines

In this case that has
the slight advantace of allowing us to keep the existing translated string as-is.

But also, is *our* pull configuration causing us to end up here?

Yes, but. The extra message is about fixing all places that the user may have setup a config for using preserve-merges, not just here. The fact that IDEs offer a menu for adding that setting makes it easy for users to get into this.
I'd agree that pull already has detection for this, but I was looking to avoid the 'fool me once, fool me twice' scenarios.

It could be dropped if thought over zealous.

Quoted 5 lines

I
vaguely recall that being discussed (probably in answer to a question of mine) in the earlier round, or is this the IDE picking it up & invoking us like this?

#25 lore raw
In reply to Ævar Arnfjörð Bjarmason
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 6 lines · Philip Oakley via GitGitGadget

This short series is a follow up to GitGitGadget "Update the die() preserve-merges messages to help some users (PR #1155)" [1].

The first patch is a tidy up of the --preserve option to highlight that it is now Deleted, rather than Deprecated.

Quoted 8 lines
Quoted 4 lines

In response to Avar's comments that the former error message merely 'tantilised without telling' the user what to do, it became obvious that the underling problem was that the user was unable to git rebase --abort which was also fatal, when a preserve-rebase was in progress.

Thanks a lot for following up on this, this all looks OK to me. I had some minor comments about maybe tweaking this & that, but as far as I'm concerned this could go in as-is, depending on whether you think it needs a re-roll in response to my comments + others.

Thanks, I am a bit busy with family issues, so I'd rather use as-is, unless other feel that the tweaks will be worth it.
I'm effectively off-line for the next 5-6 days anyway.
--
Philip

#4 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to Ævar Arnfjörð Bjarmason

Am 26.05.22 um 11:40 schrieb Ævar Arnfjörð Bjarmason:

Quoted 25 lines · Philip Oakley via GitGitGadget
Quoted 23 lines

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix the option tip.

---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/rebase.c +1 -1
index 7ab50cda2ad..6ce7e98a6f1 100644
@@ -1110,7 +1110,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 			parse_opt_interactive),
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
Quoted 8 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 3 lines
builtin/rebase.c +0 -0
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

I have some local patches for this more generally, but for PARSE_OPT_HIDDEN options we never do anything with the "argh" field, i.e. it's only used for showing the "git <cmd> -h" output, and if it's hidden it won't be there.

Hidden options are shown if you use --help-all instead of -h.

OPT_SET_INT_F always sets the struct option member "argh" to NULL. The string changed above is the "help" member, not "argh".

Quoted 8 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

This series shouldn't fix the general issue (which parse-options.c should really be BUG()-ing about, after fixing the existing occurances. But For this one we could just set this to have a string of "" or something, only the string you're changing in 3/3 will be seen by anyone.

What is the general issue?

Anyway, the new help text explaining what the option once did is a bit confusing. It would be better to focus on what it's doing now (nothing) and/or why we still have it (for backward compatibility), I think.

René

#5 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

Quoted 11 lines · René Scharfe
Quoted 6 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 6 lines
builtin/rebase.c +1 -1
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

Hidden options are shown if you use --help-all instead of -h.

OPT_SET_INT_F always sets the struct option member "argh" to NULL. The string changed above is the "help" member, not "argh".

Good points. I do think it is OK to say REMOVED in case --help-all asks us to show everything, even though I wonder if we can leave it there until we remove the "support" of noticing the user asking for a now-removed feature.

Quoted 10 lines
Quoted 8 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

This series shouldn't fix the general issue (which parse-options.c should really be BUG()-ing about, after fixing the existing occurances. But For this one we could just set this to have a string of "" or something, only the string you're changing in 3/3 will be seen by anyone.

What is the general issue?

I am afraid to ask, after having learned to be worried about those large rearchitecting projects Ævar talks about X-<.

Quoted 3 lines

Anyway, the new help text explaining what the option once did is a bit confusing. It would be better to focus on what it's doing now (nothing) and/or why we still have it (for backward compatibility), I think.

Do you mean that we should say "this option used to do such and such but it is now a no-op" after "(REMOVED)" label, instead of the above "this option does such and such"? I think "(REMOVED)" is a strong enough hint that lets us get away without saying "used to" and "but it is now a no-op", so I can accept both.

Or do you mean we should say "(REMOVED) for backward compatibility, does nothing but errors out"? I would be less in faviour, then. Those who are curious enough to ask --help-all would find it more helpful if we said what it used to do. Otherwise they wouldn't be asking --help-all in the first place, no?

#16 lore raw

Re: [PATCH 2/3] rebase: help users when dying with `preserve-merges`

In reply to Philip Oakley
Quoted 3 lines · Philip Oakley
Quoted 3 lines
Quoted 3 lines

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

This patch does not make it "available", though.

Suggest using --abort to get out of the situation after a failed preserve-rebase and remove traces of ...

perhaps?

I do think the suggestion is worth doing if a user ever gets into the situation, but how likely does it happen? A user has to start "rebase -p" with older Git, wait until Git gets updated to a future version of Git that includes this change, and then say "rebase -p --continue"?

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
builtin/rebase.c +0 -2
 	} else if (is_directory(merge_dir())) {
 		strbuf_reset(&buf);
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
-		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
Quoted 8 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1191

Quoted 7 lines
builtin/rebase.c +4 -0
+		if (is_directory(buf.buf) && !(action == ACTION_ABORT)) {
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"Use `git rebase --abort` to terminate current rebase.\n"
+			"Or downgrade to v2.33, or earlier, to complete the rebase.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());

Existing issue: No _(), shouldn't we add it?

Quoted 2 lines

This strbuf_addf is forming a path for internal use. It just happens to look like legible English ;-)

I do not think Ævar meant "%s/interactive"; the enhanced message above that you inherited from the original "no longer supported" that was not marked for translation.

Quoted 6 lines
Quoted 4 lines

I wonder if we should use die_message() + advise() in these cases, i.e. stick to why we died in die_message() and have the advise() make suggestions, as e4921d877ab (tracking branches: add advice to ambiguous refspec error, 2022-04-01) does.

Ah, maybe it's my message.. that needs translating.

Yup.

This whole '-p' business will go away in a few releases down, so a longer message give to the existing die() should be sufficient and there is no need for the choice between "yes, I am still weaning myself off of rebase -p and want to keep seeing the advice" and "thanks, I saw the message often enough, you no longer need to tell me how to get out", I would think.

Thanks.

#22 lore raw

Re: [PATCH 3/3] rebase: note `preserve` merges may be a pull config option

In reply to Philip Oakley via GitGitGadget
Quoted 3 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.35.0. However

Are you sure about that?

52f1e821 (pull: remove support for --rebase=preserve, 2021-09-07) that is in v2.34.0 and above dropped pull.rebase=preserve from the Documentation/config/pull.txt (and others). My local collection of various Git versions agrees with me. "git help config" from 2.34.0 does not list preserve as a valid choice, but 2.33.0 does.

Quoted 16 lines

users may not be aware that it is also a Pull option, and it is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the use of the preserve option in the pull config.

---
 builtin/rebase.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
builtin/rebase.c +0 -0
index aada25a8870..6fc0aaebbb8 100644

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1209

Quoted 6 lines
builtin/rebase.c +2 -1
@@ -1205,7 +1205,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Your `pull` configuration, may also invoke this option."));

What is a pull configuration? Our configuration variable names all have at least one dot in it. I think it is better to be explicit to clarify what exactly we are suggesting to fix.

"Your pull.rebase configuration may be set to 'preserve', which is no longer supported; use 'merges' instead", or somesuch?

Thanks.

#6 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to Junio C Hamano

Am 26.05.22 um 22:33 schrieb Junio C Hamano:

Quoted 19 lines
Quoted 10 lines · René Scharfe
Quoted 6 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 6 lines
builtin/rebase.c +1 -1
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

Anyway, the new help text explaining what the option once did is a bit confusing. It would be better to focus on what it's doing now (nothing) and/or why we still have it (for backward compatibility), I think.

Do you mean that we should say "this option used to do such and such but it is now a no-op" after "(REMOVED)" label, instead of the above "this option does such and such"? I think "(REMOVED)" is a strong enough hint that lets us get away without saying "used to" and "but it is now a no-op", so I can accept both.

Quoted 5 lines

Or do you mean we should say "(REMOVED) for backward compatibility, does nothing but errors out"? I would be less in faviour, then. Those who are curious enough to ask --help-all would find it more helpful if we said what it used to do. Otherwise they wouldn't be asking --help-all in the first place, no?

When I see an option labeled "REMOVED" then I get confused because a thing that says it no longer exists is obviously lying -- a removed option would simply not be listed. Here the feature is gone and its option remains, but only reports an educational message now.

Perhaps a better option help text would be something like "no longer supported, consider using --rebase-merges instead"?

René

#7 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

Quoted 12 lines · René Scharfe

Am 26.05.22 um 22:33 schrieb Junio C Hamano:

Quoted 8 lines
Quoted 6 lines · René Scharfe
Quoted 6 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 6 lines
builtin/rebase.c +1 -1
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

...
Perhaps a better option help text would be something like "no longer supported, consider using --rebase-merges instead"?

Yeah, that would read very well.

Thanks.

#23 lore raw

Re: [PATCH 3/3] rebase: note `preserve` merges may be a pull config option

In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.35.0. However

Are you sure about that?

Not any more. I think that was because of the version the user reported... It's clearly wrong, as the down grade is to 2.33.0

Quoted 24 lines

52f1e821 (pull: remove support for --rebase=preserve, 2021-09-07) that is in v2.34.0 and above dropped pull.rebase=preserve from the Documentation/config/pull.txt (and others). My local collection of various Git versions agrees with me. "git help config" from 2.34.0 does not list preserve as a valid choice, but 2.33.0 does.

Quoted 18 lines

users may not be aware that it is also a Pull option, and it is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the use of the preserve option in the pull config.

---
  builtin/rebase.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
builtin/rebase.c +0 -0
index aada25a8870..6fc0aaebbb8 100644
@@ -1205,7 +1205,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
  			     builtin_rebase_usage, 0);
 
Quoted 5 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1209

Quoted 4 lines
builtin/rebase.c +2 -1
  	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Your `pull` configuration, may also invoke this option."));

What is a pull configuration?

I was thinking of 'those that relate to the pull command';-)

Quoted 6 lines

Our configuration variable names
all have at least one dot in it. I think it is better to be explicit to clarify what exactly we are suggesting to fix.

"Your pull.rebase configuration may be set to 'preserve', which is no longer supported; use 'merges' instead", or somesuch?

That's a lot better. I'll borrow that..
P.

#11 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to René Scharfe

Hi René,

Quoted 32 lines · René Scharfe

Am 26.05.22 um 11:40 schrieb Ævar Arnfjörð Bjarmason:

Quoted 23 lines · Philip Oakley via GitGitGadget
Quoted 22 lines

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix the option tip.

---
  builtin/rebase.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
builtin/rebase.c +0 -1
index 7ab50cda2ad..6ce7e98a6f1 100644
@@ -1110,7 +1110,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
  			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
  			parse_opt_interactive),
  		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
Quoted 8 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 4 lines
builtin/rebase.c +1 -0
+			      N_("(REMOVED) try to recreate merges instead of "
  				 "ignoring them"),
  			      1, PARSE_OPT_HIDDEN),
  		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

I have some local patches for this more generally, but for PARSE_OPT_HIDDEN options we never do anything with the "argh" field, i.e. it's only used for showing the "git <cmd> -h" output, and if it's hidden it won't be there.

Quoted 4 lines

Hidden options are shown if you use --help-all instead of -h.

OPT_SET_INT_F always sets the struct option member "argh" to NULL. The string changed above is the "help" member, not "argh".

I should probably also add the verb "was" to indicate its historic use ;-)

Quoted 8 lines
Quoted 8 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

This series shouldn't fix the general issue (which parse-options.c should really be BUG()-ing about, after fixing the existing occurances. But For this one we could just set this to have a string of "" or something, only the string you're changing in 3/3 will be seen by anyone.

Quoted 7 lines

What is the general issue?

Anyway, the new help text explaining what the option once did is a bit confusing. It would be better to focus on what it's doing now (nothing) and/or why we still have it (for backward compatibility), I think.

René

P.

#9 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to Junio C Hamano
Quoted 10 lines · Junio C Hamano
Quoted 8 lines · René Scharfe
Quoted 6 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 6 lines

OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,

builtin/rebase.c +1 -1
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
  				 "ignoring them"),
  			      1, PARSE_OPT_HIDDEN),
  		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

Hidden options are shown if you use --help-all instead of -h.

Quoted 6 lines
Quoted 2 lines

OPT_SET_INT_F always sets the struct option member "argh" to NULL. The string changed above is the "help" member, not "argh".

Good points. I do think it is OK to say REMOVED in case --help-all asks us to show everything, even though I wonder if we can leave it there until we remove the "support" of noticing the user asking for a now-removed feature.

I'll add "was .." to clarify its historic use.
I expect that it'll be there for many years to catch late upgrading users, as well as those that help others stuck in this trap using a modern portable Git (esp. Windows).

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

The translation change would need to be a separate patch, no? That would make it easy to drop if not wanted. P.

#8 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to René Scharfe

Hi René

Quoted 18 lines · René Scharfe

Am 26.05.22 um 22:33 schrieb Junio C Hamano:

Quoted 17 lines
Quoted 9 lines · René Scharfe
Quoted 6 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 6 lines

OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,

builtin/rebase.c +1 -1
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
  				 "ignoring them"),
  			      1, PARSE_OPT_HIDDEN),
  		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

Anyway, the new help text explaining what the option once did is a bit confusing. It would be better to focus on what it's doing now (nothing) and/or why we still have it (for backward compatibility), I think.

Do you mean that we should say "this option used to do such and such but it is now a no-op" after "(REMOVED)" label, instead of the above "this option does such and such"? I think "(REMOVED)" is a strong enough hint that lets us get away without saying "used to" and "but it is now a no-op", so I can accept both.

Quoted 7 lines
Quoted 5 lines

Or do you mean we should say "(REMOVED) for backward compatibility, does nothing but errors out"? I would be less in faviour, then. Those who are curious enough to ask --help-all would find it more helpful if we said what it used to do. Otherwise they wouldn't be asking --help-all in the first place, no?

When I see an option labeled "REMOVED" then I get confused because a thing that says it no longer exists is obviously lying

That's a misunderstanding between the response to the command line option, and the described operation of the former sub-command/option.

Quoted 3 lines

-- a removed
option would simply not be listed. Here the feature is gone and its option remains, but only reports an educational message now.

The needed user response is more that educational. In this case (for the Series) they are in a Catch-22 situation, stuck in a no-man's land between a preserve merges that has been started, and a Git that won't proceed. Currently (prior to the series) Git will even refuse to abort..

Quoted 3 lines

Perhaps a better option help text would be something like "no longer supported, consider using --rebase-merges instead"?

We'll still need to say _what_ is no longer supported, to ensure the user has context. I'd agree with the suggestion aspect (Junio had commented similarly).

I suspect this problem could be a long, slow burner. We so rarely remove capabilities like this, so it's tricky second guessing how users will react, or when they discover the problem.

P.

#12 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to René Scharfe
Quoted 43 lines · René Scharfe

Am 26.05.22 um 11:40 schrieb Ævar Arnfjörð Bjarmason:

Quoted 25 lines · Philip Oakley via GitGitGadget
Quoted 23 lines

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix the option tip.

---
 builtin/rebase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/rebase.c +1 -1
index 7ab50cda2ad..6ce7e98a6f1 100644
@@ -1110,7 +1110,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 			parse_opt_interactive),
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
+			      N_("(REMOVED) try to recreate merges instead of "
Quoted 8 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1116

Quoted 3 lines
builtin/rebase.c +0 -0
 				 "ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),

I have some local patches for this more generally, but for PARSE_OPT_HIDDEN options we never do anything with the "argh" field, i.e. it's only used for showing the "git <cmd> -h" output, and if it's hidden it won't be there.

Hidden options are shown if you use --help-all instead of -h.

OPT_SET_INT_F always sets the struct option member "argh" to NULL. The string changed above is the "help" member, not "argh".

Quoted 3 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

Quoted 7 lines
Quoted 5 lines

This series shouldn't fix the general issue (which parse-options.c should really be BUG()-ing about, after fixing the existing occurances. But For this one we could just set this to have a string of "" or something, only the string you're changing in 3/3 will be seen by anyone.

What is the general issue?

You're right. I'd missed that case with --help-all, and remembered briefly testing where we used the string before in some WIP code.

Looking at it again I think I tried NULL-ing a few and running the tests with SANITIZE=address or something, which in this case it looks like we'd 100% pass with. I.e. we have zero test coverage for that subsequent NULL dereference.

Sorry about the noise. I'll add some tests for this case in some parse-options.c sanity checking tests/patches I'm planning to submit at some point.

#17 lore raw

Re: [PATCH 2/3] rebase: help users when dying with `preserve-merges`

In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Philip Oakley
Quoted 3 lines
Quoted 3 lines

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

This patch does not make it "available", though.

Yes it does. Sorry if the terminology or explanation was poor (here we are looking at the commit message, not the user facing message?).

Currently, if the user has an in-progress rebase with preserve-merges, and now using the latest Git, they will reach the fatal die(), even if they try any of the git status suggestions of --abort, --continue, etc.  Essentially, it's a 'you shouldn't be here', lets stop right now, go straight to jail condition. We do want to permit the rebase --abort command option.

I can swap around the && condition so that it's clearer that we check the user isn't requesting an --abort before checking the internal directory and then dying.

Quoted 8 lines

Suggest using --abort to get out of the situation after a failed preserve-rebase and remove traces of ...

perhaps?

I do think the suggestion is worth doing if a user ever gets into the situation, but how likely does it happen? A user has to start "rebase -p" with older Git,

.. hit a conflict, seeks help. Helper bring a personal portable Git with latest version - Oops.

Or Helper, says "Oh, your version is old, upgrade, and that'll fix it", again Oops.

Quoted 3 lines

wait until Git gets updated to a future
version of Git that includes this change, and then say "rebase -p --continue"?

You don't need the -p there ;-)

For this change, the "git rebase --continue" will still die() with the fatal: message. We do not have a way to continue. However..

After this change, the "git rebase --abort" will properly clear and clean the repo/status so that the user can then choose what to do.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1191

Quoted 13 lines
  	} else if (is_directory(merge_dir())) {
  		strbuf_reset(&buf);
  		strbuf_addf(&buf, "%s/rewritten", merge_dir());
builtin/rebase.c +4 -2
-		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+		if (is_directory(buf.buf) && !(action == ACTION_ABORT)) {
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"Use `git rebase --abort` to terminate current rebase.\n"
+			"Or downgrade to v2.33, or earlier, to complete the rebase.\n");
  		} else {
  			strbuf_reset(&buf);
  			strbuf_addf(&buf, "%s/interactive", merge_dir());

Existing issue: No _(), shouldn't we add it?

Quoted 5 lines
Quoted 2 lines

This strbuf_addf is forming a path for internal use. It just happens to look like legible English ;-)

I do not think Ævar meant "%s/interactive"; the enhanced message above that you inherited from the original "no longer supported" that was not marked for translation.

Ok.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

I wonder if we should use die_message() + advise() in these cases, i.e. stick to why we died in die_message() and have the advise() make suggestions, as e4921d877ab (tracking branches: add advice to ambiguous refspec error, 2022-04-01) does.

Ah, maybe it's my message.. that needs translating.

Yup.

Ok, I'd add a separate patch for that.

Quoted 6 lines

This whole '-p' business will go away in a few releases down, so a longer message give to the existing die() should be sufficient and there is no need for the choice between "yes, I am still weaning myself off of rebase -p and want to keep seeing the advice" and "thanks, I saw the message often enough, you no longer need to tell me how to get out", I would think.

I think it will take a long while for all the users, tools providers and distros to get beyond 2.33, so while each user may be weaned quickly, the generic problem is likely to continue to linger.

I hope to re-roll later next week. In general it's mainly tweaks and finesse.

Philip

#10 lore raw

Re: [PATCH 1/3] rebase.c: state preserve-merges has been removed

In reply to Philip Oakley
Quoted 7 lines · Philip Oakley
Quoted 4 lines · Junio C Hamano
Quoted 4 lines
Quoted 4 lines

So there's no point in changing this string, nor to have translators focus on it, it'll never be used.

The translation change would need to be a separate patch, no? That would make it easy to drop if not wanted.

I think you are responding to what Ævar said, but the string this patch is modifying is already inside N_(), and modifying a string that is already marked for translation in any way (other than removing the N_() or _() around it) incurs the cost to translate the updated string already, with or without any separate patch.

If we are adding a new die() call that uses a new message, we should mark the message for translation from the beginning. The messages produced by die/warning/error are meant to be read by human users, so unless there is some very strong reason not to, they should be marked for translation.

#18 lore raw

Re: [PATCH 2/3] rebase: help users when dying with `preserve-merges`

In reply to Philip Oakley
Quoted 10 lines · Philip Oakley
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Philip Oakley
Quoted 3 lines
Quoted 3 lines

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

This patch does not make it "available", though.

Yes it does. Sorry if the terminology or explanation was poor (here we are looking at the commit message, not the user facing message?).

Sorry, you're right. I misread the new "&&" condition in the patch.

Quoted 2 lines

I hope to re-roll later next week. In general it's mainly tweaks and finesse.

Thanks.

#26 lore raw

v2 cover Die preserve ggg

In reply to Philip Oakley via GitGitGadget

This [2] short series is a follow up to GitGitGadget "Update the die() preserve-merges messages to help some users (PR #1155)" [1].

Since v1: Additional patch to translate the user facing die message. Bring the --abort preclusion to the start of the if && condition for clarity. Clarify that the pull.rebase config is complementary to this particular 'die'. Updates to the commit messages.

v0: The first patch is a tidy up of the --preserve option to highlight that it is now Deleted, rather than Deprecated.

In response to Avar's comments that the former error message merely 'tantilised without telling' the user what to do, it became obvious that the underling problem was that the user was unable to git rebase --abort which was also fatal, when a preserve-rebase was in progress.

Thus the main update is to allow the rebase --abort command, even when a --preserve is in progress, to proceed. The --abort code was unchanged by the removal of the preserve option, as the resetting and clean up of internal state is common to the other rebase options.

The user facing fatal message now simply advises to abort, or downgrade to a version that has preserve-merges to complete the rebase.

The final patch highlights that some IDEs still allow the setting of the preserve-merges option as a pull config setup.

Philip Oakly

[1] GitLore ref [email protected]
https://lore.kernel.org/git/[email protected]/

[2]
https://lore.kernel.org/git/[email protected]/t/#u

Philip Oakley (4):
rebase.c: state preserve-merges has been removed
rebase: help users when dying with preserve-merges
rebase: note preserve merges may be a pull config option
rebase: translate a die(preserve-merges) message

 builtin/rebase.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

base-commit: c4f0e309ae745751d08727f24e8ff55e56355755
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1242%2FPhilipOakley%2Fdie_preserve_ggg-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1242/PhilipOakley/die_preserve_ggg-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1242

Range-diff vs v1:

1: 0a4c81d8caf ! 1: d60ec67cb06 rebase.c: state preserve-merges has been removed
@@ Commit message
Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

- Fix the option tip.
+ Fix and reflow the option tip.

@@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix
parse_opt_interactive),
OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
- N_("(DEPRECATED) try to recreate merges instead of "
-+ N_("(REMOVED) try to recreate merges instead of "
- "ignoring them"),
+- "ignoring them"),
++ N_("(REMOVED) was: try to recreate merges "
++ "instead of ignoring them"),
1, PARSE_OPT_HIDDEN),
OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
+ OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
2: d0fb5410594 ! 2: 47f27187529 rebase: help users when dying with preserve-merges
@@ Metadata
## Commit message ##
rebase: help users when dying with preserve-merges

- Git will die if a "rebase --preserve-merges" is in progress.
- Users cannot --quit, --abort or --continue the rebase.
+ Git would die if a "rebase --preserve-merges" was in progress.
+ Users could neither --quit, --abort, nor --continue the rebase.

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

- One trigger was an unexpectedly difficult to resolve conflict, as
+ One trigger case was an unexpectedly difficult to resolve conflict, as
reported on the git-users group.
(https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM)

- Tell the user the options to resolve the problem manually.
+ Other potential use-cases include git-experts using the portable
+ 'Git on a stick' to help users with an older git version.

@@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix
strbuf_addf(&buf, "%s/rewritten", merge_dir());
- if (is_directory(buf.buf)) {
- die("rebase -p is no longer supported");
-+ if (is_directory(buf.buf) && !(action == ACTION_ABORT)) {
++ if (!(action == ACTION_ABORT) && is_directory(buf.buf)) {
+ die("rebase --preserve-merges (-p) is no longer supported.\n"
+ "Use git rebase --abort to terminate current rebase.\n"
-+ "Or downgrade to v2.33, or earlier, to complete the rebase.\n");
++ "Or downgrade to v2.33, or earlier, to complete the rebase.");
} else {
strbuf_reset(&buf);
strbuf_addf(&buf, "%s/interactive", merge_dir());
3: ece3eecdc4d ! 3: fe000f06207 rebase: note preserve merges may be a pull config option
@@ Metadata
## Commit message ##
rebase: note preserve merges may be a pull config option

- The --preserve-merges option was removed by v2.35.0. However
- users may not be aware that it is also a Pull option, and it is
- still offered by major IDE vendors such as Visual Studio.
+ The --preserve-merges option was removed by v2.34.0. However
+ users may not be aware that it is also a Pull configuration option,
+ which is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to
- the use of the preserve option in the pull config.
+ the possible use of the preserve option in the pull.rebase config.
+ This is an additional 'belt and braces' information statement.

@@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix
if (preserve_merges_selected)
- die(_("--preserve-merges was replaced by --rebase-merges"));
+ die(_("--preserve-merges was replaced by --rebase-merges\n"
-+ "Your pull configuration, may also invoke this option."));
++ "Note: Your pull.rebase configuration may also be set to 'preserve',\n"
++ "which is no longer supported; use 'merges' instead"));

if (action != ACTION_NONE && total_argc != 2) {
usage_with_options(builtin_rebase_usage,
-: ----------- > 4: ae02c6d5a6e rebase: translate a die(preserve-merges) message

Signature · 1 line
gitgitgadget
#27 lore raw

PATCH v2 1/4 rebase.c: state preserve-merges has been removed

From: Philip Oakley <[email protected]>

Since feebd2d256 (rebase: hide --preserve-merges option, 2019-10-18) this option is now removed as stated in the subsequent release notes.

Fix and reflow the option tip.

---
 builtin/rebase.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
builtin/rebase.c +2 -2
index 7ab50cda2ad..bad95d98adf 100644
@@ -1110,8 +1110,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 			parse_opt_interactive),
 		OPT_SET_INT_F('p', "preserve-merges", &preserve_merges_selected,
-			      N_("(DEPRECATED) try to recreate merges instead of "
-				 "ignoring them"),
+			      N_("(REMOVED) was: try to recreate merges "
+				 "instead of ignoring them"),
 			      1, PARSE_OPT_HIDDEN),
 		OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
 		OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
Signature · 1 line
gitgitgadget
#28 lore raw

PATCH v2 2/4 rebase: help users when dying with `preserve-merges`

In reply to Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

Git would die if a "rebase --preserve-merges" was in progress. Users could neither --quit, --abort, nor --continue the rebase.

Make the rebase --abort option available to allow users to remove traces of any preserve-merges rebase, even if they had upgraded during a rebase.

One trigger case was an unexpectedly difficult to resolve conflict, as reported on the git-users group.
(https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM)

Other potential use-cases include git-experts using the portable 'Git on a stick' to help users with an older git version.

---
 builtin/rebase.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
builtin/rebase.c +4 -2
index bad95d98adf..17cc776b4b1 100644
@@ -1182,8 +1182,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	} else if (is_directory(merge_dir())) {
 		strbuf_reset(&buf);
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
-		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+		if (!(action == ACTION_ABORT) && is_directory(buf.buf)) {
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"Use `git rebase --abort` to terminate current rebase.\n"
+			"Or downgrade to v2.33, or earlier, to complete the rebase.");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
Signature · 1 line
gitgitgadget
#29 lore raw

PATCH v2 3/4 rebase: note `preserve` merges may be a pull config option

In reply to Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.34.0. However users may not be aware that it is also a Pull configuration option, which is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the possible use of the preserve option in the pull.rebase config. This is an additional 'belt and braces' information statement.

---
 builtin/rebase.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
builtin/rebase.c +3 -1
index 17cc776b4b1..5f8921551e1 100644
@@ -1205,7 +1205,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Note: Your `pull.rebase` configuration may also be  set to 'preserve',\n"
+			"which is no longer supported; use 'merges' instead"));
 
 	if (action != ACTION_NONE && total_argc != 2) {
 		usage_with_options(builtin_rebase_usage,
Signature · 1 line
gitgitgadget
#34 lore raw

PATCH v2 4/4 rebase: translate a die(preserve-merges) message

In reply to Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

This is a user facing message for a situation seen in the wild.

Translate it.

---
 builtin/rebase.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
builtin/rebase.c +2 -2
index 5f8921551e1..640b6046a5a 100644
@@ -1183,9 +1183,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		strbuf_reset(&buf);
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
 		if (!(action == ACTION_ABORT) && is_directory(buf.buf)) {
-			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			die(_("`rebase --preserve-merges` (-p) is no longer supported.\n"
 			"Use `git rebase --abort` to terminate current rebase.\n"
-			"Or downgrade to v2.33, or earlier, to complete the rebase.");
+			"Or downgrade to v2.33, or earlier, to complete the rebase."));
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
Signature · 1 line
gitgitgadget
#30 lore raw

Re: [PATCH v2 3/4] rebase: note `preserve` merges may be a pull config option

In reply to Philip Oakley via GitGitGadget
Quoted 20 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.34.0. However users may not be aware that it is also a Pull configuration option, which is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the possible use of the preserve option in the pull.rebase config. This is an additional 'belt and braces' information statement.

---
 builtin/rebase.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
builtin/rebase.c +0 -0
index 17cc776b4b1..5f8921551e1 100644

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1210

Quoted 7 lines
builtin/rebase.c +3 -1
@@ -1205,7 +1205,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Note: Your `pull.rebase` configuration may also be  set to 'preserve',\n"
+			"which is no longer supported; use 'merges' instead"));

"be set" -> "be set".

I am not sure how this helps anybody, though.

When pull.rebase is parsed, rebase.c::rebase_parse_value() is called from builtin/pull.c::parse_config_rebase() and would trigger an error, whether it comes from the pull.rebase or the branch.*.rebase configuration variable. An error() message already said that 'preserve' was removed and 'merges' would be a replacement when it happened.

If the user has *not* reached this die() due to a configuration variable, then there is not much point giving this new message, either.

#31 lore raw

Re: [PATCH v2 3/4] rebase: note `preserve` merges may be a pull config option

Sorry for delay, I had other family priorities to attend to.

Quoted 24 lines · Junio C Hamano
Quoted 22 lines · Philip Oakley via GitGitGadget

From: Philip Oakley <[email protected]>

The --preserve-merges option was removed by v2.34.0. However users may not be aware that it is also a Pull configuration option, which is still offered by major IDE vendors such as Visual Studio.

Extend the --preserve-merges die message to also direct users to the possible use of the preserve option in the pull.rebase config. This is an additional 'belt and braces' information statement.

---
 builtin/rebase.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
builtin/rebase.c +0 -0
index 17cc776b4b1..5f8921551e1 100644
@@ -1205,7 +1205,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			     builtin_rebase_usage, 0);
 
Quoted 6 lines

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1210

Quoted 5 lines
builtin/rebase.c +3 -1
 	if (preserve_merges_selected)
-		die(_("--preserve-merges was replaced by --rebase-merges"));
+		die(_("--preserve-merges was replaced by --rebase-merges\n"
+			"Note: Your `pull.rebase` configuration may also be  set to 'preserve',\n"
+			"which is no longer supported; use 'merges' instead"));

"be set" -> "be set".

Noted. I see that the series is now in next [Thank you], so not worth the churn of a patch, unless folks start noticing..

Quoted 2 lines

I am not sure how this helps anybody, though.

It's the Catch 22 problem for deleted capabilities, which we rarely see because we normally have backward compatibility.

Quoted 11 lines

When pull.rebase is parsed, rebase.c::rebase_parse_value() is called from builtin/pull.c::parse_config_rebase() and would trigger an error, whether it comes from the pull.rebase or the branch.*.rebase configuration variable. An error() message already said that 'preserve' was removed and 'merges' would be a replacement when it happened.

If the user has *not* reached this die() due to a configuration variable, then there is not much point giving this new message, either.

From my perspective, users should then be purging _all_ their preserve configurations once they hit such errors. As the v2.34.0 change propagates through the Git ecosystem, hopefully it'll be a sufficient prompt for those who haven't realised that the option can be 'hidden' in their configuration options.

Time will tell.

Thanks

Philip

#32 lore raw

Re: [PATCH v2 3/4] rebase: note `preserve` merges may be a pull config option

small clarification,

Quoted 11 lines · Philip Oakley
Quoted 10 lines

When pull.rebase is parsed, rebase.c::rebase_parse_value() is called from builtin/pull.c::parse_config_rebase() and would trigger an error, whether it comes from the pull.rebase or the branch.*.rebase configuration variable. An error() message already said that 'preserve' was removed and 'merges' would be a replacement when it happened.

If the user has *not* reached this die() due to a configuration variable, then there is not much point giving this new message, either.

From my perspective, users should then

That is, when users hit any of the preserve-merges error message, ...

Quoted 5 lines

be purging _all_ their preserve
configurations once they hit such errors. As the v2.34.0 change propagates through the Git ecosystem, hopefully it'll be a sufficient prompt for those who haven't realised that the option can be 'hidden' in their configuration options.

#33 lore raw

Re: [PATCH v2 3/4] rebase: note `preserve` merges may be a pull config option

Quoted 10 lines · Philip Oakley

small clarification,

Quoted 7 lines · Philip Oakley
Quoted 7 lines

When pull.rebase is parsed, rebase.c::rebase_parse_value() is called from builtin/pull.c::parse_config_rebase() and would trigger an error, whether it comes from the pull.rebase or the branch.*.rebase configuration variable. An error() message already said that 'preserve' was removed and 'merges' would be a replacement when it happened.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

If the user has *not* reached this die() due to a configuration variable, then there is not much point giving this new message, either.

From my perspective, users should then

That is, when users hit any of the preserve-merges error message, ...

Yes, but configuration parsing happens way earlier than the actual use of the option (which is decided after configuration and then command line is read), so the users would probably have hit the error message and corrected their configuration before they can even see this error message, no?

I guess I am repeating myself, so there may be some case where a stale variable can still be in the user's configuration file and the user can hit this error message without seeing the other error message about the stale configuration variable that I am not seeing?

Quoted 5 lines
Quoted 5 lines

be purging _all_ their preserve
configurations once they hit such errors. As the v2.34.0 change propagates through the Git ecosystem, hopefully it'll be a sufficient prompt for those who haven't realised that the option can be 'hidden' in their configuration options.