[PATCH 0/2] Update the die() preserve-merges messages to help some users

STALE1613d

18 messages, 5 authors, 2022-03-09 · open the first message on its own page

[PATCH 0/2] Update the die() preserve-merges messages to help some users

From: Johannes Schindelin via GitGitGadget <hidden>
Date: 2022-02-22 10:34:02

This small update to the die() preserve-merges messages is a response to the
reported edge case in the Git-for-Windows googlegroups thread
[https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM] where even git
rebase --continue would die.

It is most relevant for Windows because Visual Studio still offers the
option to run git pull --preserve, therefore Git for Windows already applied
these patches. The improvements are not specific to Windows, though, and
should therefore also get into core Git, albeit at a more leisurely pace.

This is a companion patch series to
https://github.com/git-for-windows/git/pull/3708

Philip Oakley (2):
  rebase: help user when dying with preserve-merges`
  rebase: `preserve` is also a pull option, tell dying users

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


base-commit: e6ebfd0e8cbbd10878070c8a356b5ad1b3ca464e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1155%2Fdscho%2Fdie_preserve-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1155/dscho/die_preserve-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1155
-- 
gitgitgadget

[PATCH 1/2] rebase: help user when dying with preserve-merges`

From: Philip Oakley via GitGitGadget <hidden>
Date: 2022-02-22 10:34:03

From: Philip Oakley <redacted>

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

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is 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 cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index d858add3fe8..07221d0ae41 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1181,7 +1181,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		strbuf_reset(&buf);
 		strbuf_addf(&buf, "%s/rewritten", merge_dir());
 		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"You still have a `.git/rebase-merge/rewritten` directory, \n"
+			"indicating a `rebase preserve-merge` is still in progress.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
-- 
gitgitgadget

[PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Philip Oakley via GitGitGadget <hidden>
Date: 2022-02-22 10:34:06

From: Philip Oakley <redacted>

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 direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 07221d0ae41..97f704bb297 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1205,7 +1205,10 @@ 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"
+			"Also, check your `pull` configuration settings\n"
+			"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
+			"which may also invoke this option."));
 
 	if (action != ACTION_NONE && total_argc != 2) {
 		usage_with_options(builtin_rebase_usage,
-- 
gitgitgadget

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

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-02-22 15:35:00

On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
From: Philip Oakley <redacted>

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

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is 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 cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.
I can go and read the linked thread for the answer, but:
 		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"You still have a `.git/rebase-merge/rewritten` directory, \n"
+			"indicating a `rebase preserve-merge` is still in progress.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
As much of an improvement this is, I'd be no closer to knowing what I
should do at this point.

Should I "rm -rf" that directory, downgrade my version of git if I'd
like to recover my work (as the message alludes to).

In either case I'd think that this is getting a bit past the length
where we'd have just a die() v.s. splitting it into a die()/advise()
pair. I.e. to have the advise() carry some bullet-point list about X/Y/Z
solutions, with the die() being a brief ~"we did because xyz dir is
still here".

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-02-22 15:41:25

On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted hunk
From: Philip Oakley <redacted>

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 direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 07221d0ae41..97f704bb297 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1205,7 +1205,10 @@ 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"
+			"Also, check your `pull` configuration settings\n"
+			"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
+			"which may also invoke this option."));
I may be missing some subtlety, but how is the user ever going to need
to check their config?

After 52f1e82178e (pull: remove support for `--rebase=preserve`,
2021-09-07) we:

    $ git -c pull.rebase=preserve pull
    error: rebase.c:29: preserve: 'preserve' superseded by 'merges'
    fatal: builtin/pull.c:45: Invalid value for pull.rebase: preserve

I.e. we'd error before this, and the "preserve_merges_selected" variable
being checked here is not affected by config, i.e. we only ever got to
this "via config" route if "pull" et al was invoking us.

But now that command dies.

If there is still a codepath where we call "rebase --preserve-merges" on
the basis of config that I've missed, shouldn't this die() be happening
there?

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Philip Oakley <hidden>
Date: 2022-02-22 15:56:15

On 22/02/2022 15:34, Ævar Arnfjörð Bjarmason wrote:
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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 direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 07221d0ae41..97f704bb297 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1205,7 +1205,10 @@ 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"
+			"Also, check your `pull` configuration settings\n"
+			"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
+			"which may also invoke this option."));
I may be missing some subtlety, but how is the user ever going to need
to check their config?

After 52f1e82178e (pull: remove support for `--rebase=preserve`,
2021-09-07) we:

    $ git -c pull.rebase=preserve pull
    error: rebase.c:29: preserve: 'preserve' superseded by 'merges'
    fatal: builtin/pull.c:45: Invalid value for pull.rebase: preserve

I.e. we'd error before this, and the "preserve_merges_selected" variable
being checked here is not affected by config, i.e. we only ever got to
this "via config" route if "pull" et al was invoking us.

But now that command dies.

If there is still a codepath where we call "rebase --preserve-merges" on
the basis of config that I've missed, shouldn't this die() be happening
there?
Hi Ævar,

The preserve merges is a pull config item, still supported by Visual
Studio, so could easily be set for many users. When they click on the
"Pull" menu and get the old die() fatal: message they won't know why
this happened or how to resolve it. Hence the extra info.

If the user was actually running a rebase command then, yes, they
would/should be reasonably OK with the original error message telling
them what was wrong with their command line. But a `git pull`?
especially as the manual says nothing about preserve merges any more.

If we are to remove a capability the `give up and die` messages should
be helpful in the edge cases. The issue (needing to check the pull, as
well as the rebase configs) has already shown on the git-users list. It
took a while to workout how it all happened.

Not sure if I've covered your concerns properly, but this is one of the
places that can and warn the user.

Philip

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

From: Philip Oakley <hidden>
Date: 2022-02-22 16:06:15

On 22/02/2022 15:32, Ævar Arnfjörð Bjarmason wrote:
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is 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 cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.
I can go and read the linked thread for the answer, but:
quoted
 		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"You still have a `.git/rebase-merge/rewritten` directory, \n"
+			"indicating a `rebase preserve-merge` is still in progress.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
As much of an improvement this is, I'd be no closer to knowing what I
should do at this point.

Should I "rm -rf" that directory, downgrade my version of git if I'd
like to recover my work (as the message alludes to).

In either case I'd think that this is getting a bit past the length
where we'd have just a die() v.s. splitting it into a die()/advise()
pair. I.e. to have the advise() carry some bullet-point list about X/Y/Z
solutions, with the die() being a brief ~"we did because xyz dir is
still here".
Hi Ævar,

Exactly. This is a slightly special, but real, case. The previous
message was essentially totally opaque to users. An "If I were you I
wouldn't start from here" response is somewhat true, so we simply tell
the user how they got to receive the fatal message. They can then take
any of the options they choose.

Ultimately the user downgraded and managed to use "rebase --continue",
as advised by Git, without the response "fatal:" to complete their old
preserve-merges rebase.

They'll hit a similar fault in short order because when they next `pull`
they'll be slipped into trying the preserve-merge rebase again - that's
the 2/2 patch, making sure they know why.

Philip

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Philip Oakley <hidden>
Date: 2022-02-22 17:49:01

Hi Ævar,

On 22/02/2022 15:56, Philip Oakley wrote:
On 22/02/2022 15:34, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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 direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 07221d0ae41..97f704bb297 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1205,7 +1205,10 @@ 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"
+			"Also, check your `pull` configuration settings\n"
+			"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
+			"which may also invoke this option."));
I may be missing some subtlety, but how is the user ever going to need
to check their config?

After 52f1e82178e (pull: remove support for `--rebase=preserve`,
2021-09-07) we:

    $ git -c pull.rebase=preserve pull
    error: rebase.c:29: preserve: 'preserve' superseded by 'merges'
    fatal: builtin/pull.c:45: Invalid value for pull.rebase: preserve

I.e. we'd error before this, and the "preserve_merges_selected" variable
being checked here is not affected by config, i.e. we only ever got to
this "via config" route if "pull" et al was invoking us.

But now that command dies.

If there is still a codepath where we call "rebase --preserve-merges" on
the basis of config that I've missed, shouldn't this die() be happening
there?
Hi Ævar,

The preserve merges is a pull config item, still supported by Visual
Studio, so could easily be set for many users. When they click on the
"Pull" menu and get the old die() fatal: message they won't know why
this happened or how to resolve it. Hence the extra info.

If the user was actually running a rebase command then, yes, they
would/should be reasonably OK with the original error message telling
them what was wrong with their command line. But a `git pull`?
especially as the manual says nothing about preserve merges any more.

If we are to remove a capability the `give up and die` messages should
be helpful in the edge cases. The issue (needing to check the pull, as
well as the rebase configs) has already shown on the git-users list. It
took a while to workout how it all happened.

Not sure if I've covered your concerns properly, but this is one of the
places that can and warn the user.
I don't think that came out well. For this message, it's about reminding
users that they may *also* be using the `preserve` option within their
pull options, and not just within their rebase command's options.

A case of "don't use it here, and don't use it there either, please check".

Philip

Re: [PATCH 0/2] Update the die() preserve-merges messages to help some users

From: Phillip Wood <hidden>
Date: 2022-02-22 18:55:24

Hi Philip

On 22/02/2022 10:33, Johannes Schindelin via GitGitGadget wrote:
This small update to the die() preserve-merges messages is a response to the
reported edge case in the Git-for-Windows googlegroups thread
[https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM] where even git
rebase --continue would die.

It is most relevant for Windows because Visual Studio still offers the
option to run git pull --preserve, therefore Git for Windows already applied
these patches. The improvements are not specific to Windows, though, and
should therefore also get into core Git, albeit at a more leisurely pace.
I think the new messages are an improvement, I was wondering how 
difficult it would be to allow the user to run rebase --abort so they 
can at least easily start again with --rebase-merges.

Best Wishes

Phillip
This is a companion patch series to
https://github.com/git-for-windows/git/pull/3708

Philip Oakley (2):
   rebase: help user when dying with preserve-merges`
   rebase: `preserve` is also a pull option, tell dying users

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


base-commit: e6ebfd0e8cbbd10878070c8a356b5ad1b3ca464e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1155%2Fdscho%2Fdie_preserve-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1155/dscho/die_preserve-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1155

Re: [PATCH 0/2] Update the die() preserve-merges messages to help some users

From: Philip Oakley <hidden>
Date: 2022-02-22 20:25:05

Hi Phillip,

On 22/02/2022 18:55, Phillip Wood wrote:
Hi Philip

On 22/02/2022 10:33, Johannes Schindelin via GitGitGadget wrote:
quoted
This small update to the die() preserve-merges messages is a response
to the
reported edge case in the Git-for-Windows googlegroups thread
[https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM] where
even git
rebase --continue would die.

It is most relevant for Windows because Visual Studio still offers the
option to run git pull --preserve, therefore Git for Windows already
applied
these patches. The improvements are not specific to Windows, though, and
should therefore also get into core Git, albeit at a more leisurely
pace.
I think the new messages are an improvement, I was wondering how
difficult it would be to allow the user to run rebase --abort so they
can at least easily start again with --rebase-merges.
In this case, the user (another Phillip), couldn't run `rebase
--continue` without getting a `fatal:` report. A code inspection showed
that was one of the first tests so I don't believe they could run
`--quit` or `abort` either!

We eventually nailed it down to being an update of Git, after getting
into a bad conflict resolution, so the update refused to do any rebase
commands! Later they tried downgrading and finishing the rebase that way
in the usual 'hack & hope' way. Luckily they had a backup from the time
of the update, which was able to confirm the presence of the indicative
directory (which is an implementation detail).

If the `rebase abort` was moved earlier in the code, then it might work,
but we'd still need to keep the clean-up code for a non-existent option,
which is less than ideal .

Philip
Best Wishes

Phillip
quoted
This is a companion patch series to
https://github.com/git-for-windows/git/pull/3708

Philip Oakley (2):
   rebase: help user when dying with preserve-merges`
   rebase: `preserve` is also a pull option, tell dying users

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


base-commit: e6ebfd0e8cbbd10878070c8a356b5ad1b3ca464e
Published-As:
https://github.com/gitgitgadget/git/releases/tag/pr-1155%2Fdscho%2Fdie_preserve-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git
pr-1155/dscho/die_preserve-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1155

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

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-02-23 10:23:42

On Tue, Feb 22 2022, Philip Oakley wrote:
On 22/02/2022 15:32, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is 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 cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.
I can go and read the linked thread for the answer, but:
quoted
 		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"You still have a `.git/rebase-merge/rewritten` directory, \n"
+			"indicating a `rebase preserve-merge` is still in progress.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
As much of an improvement this is, I'd be no closer to knowing what I
should do at this point.

Should I "rm -rf" that directory, downgrade my version of git if I'd
like to recover my work (as the message alludes to).

In either case I'd think that this is getting a bit past the length
where we'd have just a die() v.s. splitting it into a die()/advise()
pair. I.e. to have the advise() carry some bullet-point list about X/Y/Z
solutions, with the die() being a brief ~"we did because xyz dir is
still here".
Hi Ævar,

Exactly. This is a slightly special, but real, case. The previous
message was essentially totally opaque to users. An "If I were you I
wouldn't start from here" response is somewhat true, so we simply tell
the user how they got to receive the fatal message. They can then take
any of the options they choose.

Ultimately the user downgraded and managed to use "rebase --continue",
as advised by Git, without the response "fatal:" to complete their old
preserve-merges rebase.
Right. I'm pointing out that in this proposed version of the die()
message we stop just short of actually telling the user how to proceed.

I.e. just that they have a X directory, not that they should either
remove X and lose their work, or downgrade git, proceed, and then
upgrade git.
They'll hit a similar fault in short order because when they next `pull`
they'll be slipped into trying the preserve-merge rebase again - that's
the 2/2 patch, making sure they know why.
Well, this is "rebase". You can have been running rebases in a
repository without ever having any interactions with remotes.

And even if you had interactions with remotes you might be doing so via
"git fetch" followed by "git rebase", and might not ever invoke "git
pull".

And even if you did a "git pull" later shouldn't the error you got here
be sufficiently stand-alone as to tell you what to do, without needing a
later "pull"?

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-02-23 10:36:13

On Tue, Feb 22 2022, Philip Oakley wrote:
Hi Ævar,

On 22/02/2022 15:56, Philip Oakley wrote:
quoted
On 22/02/2022 15:34, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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 direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 07221d0ae41..97f704bb297 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1205,7 +1205,10 @@ 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"
+			"Also, check your `pull` configuration settings\n"
+			"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
+			"which may also invoke this option."));
I may be missing some subtlety, but how is the user ever going to need
to check their config?

After 52f1e82178e (pull: remove support for `--rebase=preserve`,
2021-09-07) we:

    $ git -c pull.rebase=preserve pull
    error: rebase.c:29: preserve: 'preserve' superseded by 'merges'
    fatal: builtin/pull.c:45: Invalid value for pull.rebase: preserve

I.e. we'd error before this, and the "preserve_merges_selected" variable
being checked here is not affected by config, i.e. we only ever got to
this "via config" route if "pull" et al was invoking us.

But now that command dies.

If there is still a codepath where we call "rebase --preserve-merges" on
the basis of config that I've missed, shouldn't this die() be happening
there?
Hi Ævar,

The preserve merges is a pull config item, still supported by Visual
Studio, so could easily be set for many users. When they click on the
"Pull" menu and get the old die() fatal: message they won't know why
this happened or how to resolve it. Hence the extra info.

If the user was actually running a rebase command then, yes, they
would/should be reasonably OK with the original error message telling
them what was wrong with their command line. But a `git pull`?
especially as the manual says nothing about preserve merges any more.

If we are to remove a capability the `give up and die` messages should
be helpful in the edge cases. The issue (needing to check the pull, as
well as the rebase configs) has already shown on the git-users list. It
took a while to workout how it all happened.

Not sure if I've covered your concerns properly, but this is one of the
places that can and warn the user.
I don't think that came out well. For this message, it's about reminding
users that they may *also* be using the `preserve` option within their
pull options, and not just within their rebase command's options.

A case of "don't use it here, and don't use it there either, please check".
I see. What I was confused with (and still find confusing) is that the
error here says "[and the pull.rebase=preserve config] may also invoke
this option".

But it doesn't do that at all, it *used to*, but now "git pull" will
promptly fail on it as well.

So this is really just trying to tell us something like this, right?

    Hey, you invoked --preserve-merges, bad mojo! Also: if you invoke
    'git pull' and used the related config you may or may not have used,
    that'll die too. So maybe check that out?

:)

Anyway, to the user the "invoke this option" isn't strictly accurate,
but they probably don't care/know the difference, so I don't mind
per-se, I was just wondering if I was missing something.

I do wonder if this part is needed at all. I.e. at this point this will
only benefit users who are *manually* invoking "git rebase
--preserve-merges", everyone else (including that "VS" example you
mentioned) will go through "git pull" and see the other error.

IOW maybe just saying "this option is an error now" when we intercept
the option is enough, and ditto for "this config is an error now" when
we intercept the config, and not assume that a user using the option
must also be using the config is simpler/sufficient.

Just my 0.02. For my part whahtever you decide to do here is fine by me,
I was just wondering if I'd misundestood the whole flow around this
legacy option and how we invoke the small parts of die() boilerplate
left of it.

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

From: Philip Oakley <hidden>
Date: 2022-02-23 17:44:41

On 23/02/2022 10:20, Ævar Arnfjörð Bjarmason wrote:
On Tue, Feb 22 2022, Philip Oakley wrote:
quoted
On 22/02/2022 15:32, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is 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 cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.
I can go and read the linked thread for the answer, but:
quoted
 		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"You still have a `.git/rebase-merge/rewritten` directory, \n"
+			"indicating a `rebase preserve-merge` is still in progress.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
As much of an improvement this is, I'd be no closer to knowing what I
should do at this point.

Should I "rm -rf" that directory, downgrade my version of git if I'd
like to recover my work (as the message alludes to).

In either case I'd think that this is getting a bit past the length
where we'd have just a die() v.s. splitting it into a die()/advise()
pair. I.e. to have the advise() carry some bullet-point list about X/Y/Z
solutions, with the die() being a brief ~"we did because xyz dir is
still here".
Hi Ævar,

Exactly. This is a slightly special, but real, case. The previous
message was essentially totally opaque to users. An "If I were you I
wouldn't start from here" response is somewhat true, so we simply tell
the user how they got to receive the fatal message. They can then take
any of the options they choose.

Ultimately the user downgraded and managed to use "rebase --continue",
as advised by Git, without the response "fatal:" to complete their old
preserve-merges rebase.
Right. I'm pointing out that in this proposed version of the die()
message we stop just short of actually telling the user how to proceed.

I.e. just that they have a X directory, not that they should either
remove X and lose their work, or downgrade git, proceed, and then
upgrade git.
In a sense, that is it. They are in a difficult place, but with at least
a little information to seek further information and start making their
choices. Before, they (users in difficulty) were rather uninformed.
quoted
They'll hit a similar fault in short order because when they next `pull`
they'll be slipped into trying the preserve-merge rebase again - that's
the 2/2 patch, making sure they know why.
Well, this is "rebase". You can have been running rebases in a
repository without ever having any interactions with remotes.
True. That is a possibility. But we have also removed the preserve
option for interaction with remotes as well.
And even if you had interactions with remotes you might be doing so via
"git fetch" followed by "git rebase", and might not ever invoke "git
pull".

And even if you did a "git pull" later shouldn't the error you got here
be sufficiently stand-alone as to tell you what to do, without needing a
later "pull"?
Why are we delaying telling the user that they would have problems there
as well? It shouldn't be a game about how many ways we can trip up the user.

It's a pity the problem has split into the different ways into disaster.

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Philip Oakley <hidden>
Date: 2022-03-04 14:30:03

Sorry for the delay. I've got some on-going family matters to attend to
which have limited my availablilty.

On 23/02/2022 10:27, Ævar Arnfjörð Bjarmason wrote:
On Tue, Feb 22 2022, Philip Oakley wrote:
quoted
Hi Ævar,

On 22/02/2022 15:56, Philip Oakley wrote:
quoted
On 22/02/2022 15:34, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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 direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 builtin/rebase.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 07221d0ae41..97f704bb297 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1205,7 +1205,10 @@ 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"
+			"Also, check your `pull` configuration settings\n"
+			"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
+			"which may also invoke this option."));
I may be missing some subtlety, but how is the user ever going to need
to check their config?

After 52f1e82178e (pull: remove support for `--rebase=preserve`,
2021-09-07) we:

    $ git -c pull.rebase=preserve pull
    error: rebase.c:29: preserve: 'preserve' superseded by 'merges'
    fatal: builtin/pull.c:45: Invalid value for pull.rebase: preserve

I.e. we'd error before this, and the "preserve_merges_selected" variable
being checked here is not affected by config, i.e. we only ever got to
this "via config" route if "pull" et al was invoking us.

But now that command dies.

If there is still a codepath where we call "rebase --preserve-merges" on
the basis of config that I've missed, shouldn't this die() be happening
there?
Hi Ævar,

The preserve merges is a pull config item, still supported by Visual
Studio, so could easily be set for many users. When they click on the
"Pull" menu and get the old die() fatal: message they won't know why
this happened or how to resolve it. Hence the extra info.

If the user was actually running a rebase command then, yes, they
would/should be reasonably OK with the original error message telling
them what was wrong with their command line. But a `git pull`?
especially as the manual says nothing about preserve merges any more.

If we are to remove a capability the `give up and die` messages should
be helpful in the edge cases. The issue (needing to check the pull, as
well as the rebase configs) has already shown on the git-users list. It
took a while to workout how it all happened.

Not sure if I've covered your concerns properly, but this is one of the
places that can and warn the user.
I don't think that came out well. For this message, it's about reminding
users that they may *also* be using the `preserve` option within their
pull options, and not just within their rebase command's options.

A case of "don't use it here, and don't use it there either, please check".
I see. What I was confused with (and still find confusing) is that the
error here says "[and the pull.rebase=preserve config] may also invoke
this option".

But it doesn't do that at all, it *used to*, but now "git pull" will
promptly fail on it as well.
Ok, That's probably my local idiom that confusing the now of the error
and the past when the config would have been set up. I'll see if I can
clarify that better.
So this is really just trying to tell us something like this, right?

    Hey, you invoked --preserve-merges, bad mojo! Also: if you invoke
    'git pull' and used the related config you may or may not have used,
    that'll die too. So maybe check that out?

:)

Anyway, to the user the "invoke this option" isn't strictly accurate,
but they probably don't care/know the difference, so I don't mind
per-se, I was just wondering if I was missing something.

I do wonder if this part is needed at all. I.e. at this point this will
only benefit users who are *manually* invoking "git rebase
--preserve-merges", everyone else (including that "VS" example you
mentioned) will go through "git pull" and see the other error.

IOW maybe just saying "this option is an error now" when we intercept
the option is enough, and ditto for "this config is an error now" when
we intercept the config, and not assume that a user using the option
must also be using the config is simpler/sufficient.
Error reporting is a tricky subject, especially when we add the human
error and misunderstanding aspects into the mix.
Just my 0.02. For my part whahtever you decide to do here is fine by me,
I was just wondering if I'd misundestood the whole flow around this
legacy option and how we invoke the small parts of die() boilerplate
left of it.
Yep, it is tricky talking about disappeared options, the error messages,
and the multiple ways that show themselves. In the originating edge case
it wasn't helped by a Git advice message that contained the failing
command line (`git rebase --continue`) suggestion. In general I was
trying to cover all the possible sources in all the places the 'error'
may occur.

I'll have another look at the ways these edge cases could appear, and
try an improve the commit message explanations where the diff doesn't
show sufficient context. It'll be at least next week.

Philip

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Johannes Schindelin <hidden>
Date: 2022-03-07 16:43:23

Hi Philip,

On Fri, 4 Mar 2022, Philip Oakley wrote:
I'll have another look at the ways these edge cases could appear, and
try an improve the commit message explanations where the diff doesn't
show sufficient context. It'll be at least next week.
Can I punt this patch series back to you? (I sent it upstream on your
behalf because I had assumed that you'd want me to, sorry for
misunderstanding your intentions.)

Ciao,
Dscho

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Philip Oakley <hidden>
Date: 2022-03-07 23:27:12

Hi Dscho,

On 07/03/2022 16:43, Johannes Schindelin wrote:
Hi Philip,

On Fri, 4 Mar 2022, Philip Oakley wrote:
quoted
I'll have another look at the ways these edge cases could appear, and
try an improve the commit message explanations where the diff doesn't
show sufficient context. It'll be at least next week.
Can I punt this patch series back to you? (I sent it upstream on your
behalf because I had assumed that you'd want me to, sorry for
misunderstanding your intentions.)
I'm happy to continue to work on this series, and am grateful for your
support in pushing it through GGG. How is it best to transfer the
'ownership' at GGG?

I've still got some family issues so it'll be later in the week, or even
next week before I can update the series.

Thanks.
Philip

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

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-03-08 13:51:02

On Wed, Feb 23 2022, Philip Oakley wrote:
On 23/02/2022 10:20, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley wrote:
quoted
On 22/02/2022 15:32, Ævar Arnfjörð Bjarmason wrote:
quoted
On Tue, Feb 22 2022, Philip Oakley via GitGitGadget wrote:
quoted
From: Philip Oakley <redacted>

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

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is 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 cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.
I can go and read the linked thread for the answer, but:
quoted
 		if (is_directory(buf.buf)) {
-			die("`rebase -p` is no longer supported");
+			die("`rebase --preserve-merges` (-p) is no longer supported.\n"
+			"You still have a `.git/rebase-merge/rewritten` directory, \n"
+			"indicating a `rebase preserve-merge` is still in progress.\n");
 		} else {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "%s/interactive", merge_dir());
As much of an improvement this is, I'd be no closer to knowing what I
should do at this point.

Should I "rm -rf" that directory, downgrade my version of git if I'd
like to recover my work (as the message alludes to).

In either case I'd think that this is getting a bit past the length
where we'd have just a die() v.s. splitting it into a die()/advise()
pair. I.e. to have the advise() carry some bullet-point list about X/Y/Z
solutions, with the die() being a brief ~"we did because xyz dir is
still here".
Hi Ævar,

Exactly. This is a slightly special, but real, case. The previous
message was essentially totally opaque to users. An "If I were you I
wouldn't start from here" response is somewhat true, so we simply tell
the user how they got to receive the fatal message. They can then take
any of the options they choose.

Ultimately the user downgraded and managed to use "rebase --continue",
as advised by Git, without the response "fatal:" to complete their old
preserve-merges rebase.
Right. I'm pointing out that in this proposed version of the die()
message we stop just short of actually telling the user how to proceed.

I.e. just that they have a X directory, not that they should either
remove X and lose their work, or downgrade git, proceed, and then
upgrade git.
In a sense, that is it. They are in a difficult place, but with at least
a little information to seek further information and start making their
choices. Before, they (users in difficulty) were rather uninformed.
Yes, it's definitely an improvement. I'm just wondering if we can tell
them a bit more so that they're not needing to search "what do do about
.git/rebase-merge/rewritten" on Google/stackoverflow/whatever.

I.e. can we just specifically say that they either need to downgrade,
continue, upgrade, or alternatively rm -rf it, depending on wheher
they'd like to not lose their work, or if that's OK?
quoted
quoted
They'll hit a similar fault in short order because when they next `pull`
they'll be slipped into trying the preserve-merge rebase again - that's
the 2/2 patch, making sure they know why.
Well, this is "rebase". You can have been running rebases in a
repository without ever having any interactions with remotes.
True. That is a possibility. But we have also removed the preserve
option for interaction with remotes as well.
*Nod*, presumably you mean its removal from "builtin/pull.c" etc.
quoted
And even if you had interactions with remotes you might be doing so via
"git fetch" followed by "git rebase", and might not ever invoke "git
pull".

And even if you did a "git pull" later shouldn't the error you got here
be sufficiently stand-alone as to tell you what to do, without needing a
later "pull"?
Why are we delaying telling the user that they would have problems there
as well? It shouldn't be a game about how many ways we can trip up the user.

It's a pity the problem has split into the different ways into disaster.
I'm just saying that the reason the message is a bit confusing is
because we *are* delaying it. I.e. we could give a more specific error
message in builtin/pull.c, but the "preserve merges" scaffolding was
already removed from it.

Which is why we're doing it in builtin/rebase.c, and suggesting "tweak
your pull settings", to a user who may or may not have arrived there
after a "pull" (and may not be using remotes at all).

I think overall that's OK in this case, i.e. this fix shouldn't be held
up by putting that scaffolding in place in builtin/pull.c again to
slightly improve the error.

But perhaps in the 2/2 error just say instead: "if you arrived here via
'git pull' ....". I.e. no extra code, just a slight tweak to the
message, and any user seeing it by invoking "rebase" directly won't be
further confused about why the error is saying something about "pull"
(which they didn't run).

Re: [PATCH 2/2] rebase: `preserve` is also a pull option, tell dying users

From: Johannes Schindelin <hidden>
Date: 2022-03-09 12:18:30

Hi Philip,

On Mon, 7 Mar 2022, Philip Oakley wrote:
On 07/03/2022 16:43, Johannes Schindelin wrote:
quoted
Hi Philip,

On Fri, 4 Mar 2022, Philip Oakley wrote:
quoted
I'll have another look at the ways these edge cases could appear, and
try an improve the commit message explanations where the diff doesn't
show sufficient context. It'll be at least next week.
Can I punt this patch series back to you? (I sent it upstream on your
behalf because I had assumed that you'd want me to, sorry for
misunderstanding your intentions.)
I'm happy to continue to work on this series, and am grateful for your
support in pushing it through GGG. How is it best to transfer the
'ownership' at GGG?
Sadly, I don't know of any way how I could transfer ownership to you, but
maybe you can just open a new one and reference the first thread in the
cover letter?
I've still got some family issues so it'll be later in the week, or even
next week before I can update the series.
Sorry to hear that you have issues. These are tough times, and I feel for
you.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help