git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] Make rebase.reschedulefailedexec less overzealous
@ 2019-06-27  8:12 Johannes Schindelin via GitGitGadget
  2019-06-27  8:12 ` [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases Johannes Schindelin via GitGitGadget
  2019-07-01 11:58 ` [PATCH v2 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
  0 siblings, 2 replies; 13+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-06-27  8:12 UTC (permalink / raw)
  To: git; +Cc: Vas Sudanagunta, Junio C Hamano

This config setting is pretty useful, but it unfortunately stops all
non-interactive rebases with a bogus error message. This patch fixes that.

Reported via a commit comment on GitHub
[https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187].

Johannes Schindelin (1):
  Let rebase.reschedulefailedexec only affect interactive rebases

 builtin/rebase.c           | 7 +++++--
 t/t3418-rebase-continue.sh | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)


base-commit: e11ff8975bedc0aae82632c3cb72578c3d7fc0b2
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-253%2Fdscho%2Freschedule-failed-exec-gently-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-253/dscho/reschedule-failed-exec-gently-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/253
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-27  8:12 [PATCH 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
@ 2019-06-27  8:12 ` Johannes Schindelin via GitGitGadget
  2019-06-27 18:32   ` Junio C Hamano
  2019-07-01 11:58 ` [PATCH v2 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
  1 sibling, 1 reply; 13+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-06-27  8:12 UTC (permalink / raw)
  To: git; +Cc: Vas Sudanagunta, Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

It does not make sense to stop non-interactive rebases when that config
setting is set to `true`.

Reported by Vas Sudanagunta via:
https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin/rebase.c           | 7 +++++--
 t/t3418-rebase-continue.sh | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 4839e52555..78c3bd0634 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -834,6 +834,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	struct string_list strategy_options = STRING_LIST_INIT_NODUP;
 	struct object_id squash_onto;
 	char *squash_onto_name = NULL;
+	int reschedule_failed_exec = -1;
 	struct option builtin_rebase_options[] = {
 		OPT_STRING(0, "onto", &options.onto_name,
 			   N_("revision"),
@@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		OPT_BOOL(0, "root", &options.root,
 			 N_("rebase all reachable commits up to the root(s)")),
 		OPT_BOOL(0, "reschedule-failed-exec",
-			 &options.reschedule_failed_exec,
+			 &reschedule_failed_exec,
 			 N_("automatically re-schedule any `exec` that fails")),
 		OPT_END(),
 	};
@@ -1227,8 +1228,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (options.reschedule_failed_exec && !is_interactive(&options))
+	if (reschedule_failed_exec > 0 && !is_interactive(&options))
 		die(_("--reschedule-failed-exec requires an interactive rebase"));
+	if (reschedule_failed_exec >= 0)
+		options.reschedule_failed_exec = reschedule_failed_exec;
 
 	if (options.git_am_opts.argc) {
 		/* all am options except -q are compatible only with --am */
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index bdaa511bb0..4eff14dae5 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
 	test_i18ngrep "has been rescheduled" err
 '
 
+test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
+	test_config rebase.reschedulefailedexec true &&
+	test_must_fail git rebase -x false HEAD^ &&
+	grep "^exec false" .git/rebase-merge/git-rebase-todo &&
+	git rebase --abort &&
+	git rebase HEAD^
+'
+
 test_done
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-27  8:12 ` [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases Johannes Schindelin via GitGitGadget
@ 2019-06-27 18:32   ` Junio C Hamano
  2019-06-28 11:49     ` Johannes Schindelin
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2019-06-27 18:32 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget
  Cc: git, Vas Sudanagunta, Johannes Schindelin

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> It does not make sense to stop non-interactive rebases when that config
> setting is set to `true`.

The reader is assumed to know that that config setting is only about
interactive rebases, including "rebase -x", which probably is an OK
explanation.

The subject needs a bit more work, though.  

"rebase: ignore rebase.reschedulefailedexec unless interative"

or something like that, perhaps.

> @@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  		OPT_BOOL(0, "root", &options.root,
>  			 N_("rebase all reachable commits up to the root(s)")),
>  		OPT_BOOL(0, "reschedule-failed-exec",
> -			 &options.reschedule_failed_exec,
> +			 &reschedule_failed_exec,
>  			 N_("automatically re-schedule any `exec` that fails")),
>  		OPT_END(),
>  	};
> @@ -1227,8 +1228,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  		break;
>  	}
>  
> -	if (options.reschedule_failed_exec && !is_interactive(&options))
> +	if (reschedule_failed_exec > 0 && !is_interactive(&options))

OK, it used to be that we got affected by what came from "options",
which was read from the configuration.  Now we only pay attention to
the command line, which makes sense.

At this point, we have already examined '-x' and called
imply_interative(), so this should trigger for '-x' (without '-i'),
right?

>  		die(_("--reschedule-failed-exec requires an interactive rebase"));

I wonder if users understand that '-x' is "an interctive rebase".
The documentation can read both ways, and one of these may want to
be clarified.

	-x <cmd>, --exec <cmd>
	...
	This uses the --interactive machinery internally, but it can
	be run without an explicit --interactive.

Is it saying that use of interactive machinery is an impelementation
detail the users should not concern themselves (in which case, the
message given to "die()" above is misleading---not a new problem
with this patch, though)?  Is it saying "-x" makes it plenty clear
that the user wants interactive behaviour, so the users do not need
to spell out --interactive in order to ask for it (in which case,
"die()" message is fine, but "... internally, but ..." is
misleading)?

> +	if (reschedule_failed_exec >= 0)
> +		options.reschedule_failed_exec = reschedule_failed_exec;

OK, here we recover the bit that is only stored in a local variable
and pass it into cmd_rebase__interactive() machinery via the options
structure, which lets the codepath after this point oblivious to
this change, which is good ;-).

>  	if (options.git_am_opts.argc) {
>  		/* all am options except -q are compatible only with --am */
> diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
> index bdaa511bb0..4eff14dae5 100755
> --- a/t/t3418-rebase-continue.sh
> +++ b/t/t3418-rebase-continue.sh
> @@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
>  	test_i18ngrep "has been rescheduled" err
>  '
>  
> +test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
> +	test_config rebase.reschedulefailedexec true &&
> +	test_must_fail git rebase -x false HEAD^ &&

These three lines gives us a concise summary of this patch ;-)

 - The test title can serve as a starting point for a much better
   patch title.

 - We trigger for '-x' without requiring '-i'.

> +	grep "^exec false" .git/rebase-merge/git-rebase-todo &&
> +	git rebase --abort &&
> +	git rebase HEAD^
> +'
> +
>  test_done

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-27 18:32   ` Junio C Hamano
@ 2019-06-28 11:49     ` Johannes Schindelin
  2019-06-28 13:44       ` Phillip Wood
  0 siblings, 1 reply; 13+ messages in thread
From: Johannes Schindelin @ 2019-06-28 11:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin via GitGitGadget, git, Vas Sudanagunta

Hi Junio,

On Thu, 27 Jun 2019, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > It does not make sense to stop non-interactive rebases when that config
> > setting is set to `true`.
>
> The reader is assumed to know that that config setting is only about
> interactive rebases, including "rebase -x", which probably is an OK
> explanation.

You're right, it is okay, but could be better.

> The subject needs a bit more work, though.
>
> "rebase: ignore rebase.reschedulefailedexec unless interative"
>
> or something like that, perhaps.

Right.

> > @@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> >  		OPT_BOOL(0, "root", &options.root,
> >  			 N_("rebase all reachable commits up to the root(s)")),
> >  		OPT_BOOL(0, "reschedule-failed-exec",
> > -			 &options.reschedule_failed_exec,
> > +			 &reschedule_failed_exec,
> >  			 N_("automatically re-schedule any `exec` that fails")),
> >  		OPT_END(),
> >  	};
> > @@ -1227,8 +1228,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> >  		break;
> >  	}
> >
> > -	if (options.reschedule_failed_exec && !is_interactive(&options))
> > +	if (reschedule_failed_exec > 0 && !is_interactive(&options))
>
> OK, it used to be that we got affected by what came from "options",
> which was read from the configuration.  Now we only pay attention to
> the command line, which makes sense.
>
> At this point, we have already examined '-x' and called
> imply_interative(), so this should trigger for '-x' (without '-i'),
> right?

Yes, at this point we have done all the parsing and automatic implying,
and check for incompatible options.

> >  		die(_("--reschedule-failed-exec requires an interactive rebase"));
>
> I wonder if users understand that '-x' is "an interctive rebase".
> The documentation can read both ways, and one of these may want to
> be clarified.
>
> 	-x <cmd>, --exec <cmd>
> 	...
> 	This uses the --interactive machinery internally, but it can
> 	be run without an explicit --interactive.
>
> Is it saying that use of interactive machinery is an impelementation
> detail the users should not concern themselves (in which case, the
> message given to "die()" above is misleading---not a new problem
> with this patch, though)?  Is it saying "-x" makes it plenty clear
> that the user wants interactive behaviour, so the users do not need
> to spell out --interactive in order to ask for it (in which case,
> "die()" message is fine, but "... internally, but ..." is
> misleading)?

Hmm. What would you think about:

  		die(_("--reschedule-failed-exec requires --exec or --interactive"));

?

It is still not _complete_, but at least it should be a ton less
confusing.

> > +	if (reschedule_failed_exec >= 0)
> > +		options.reschedule_failed_exec = reschedule_failed_exec;
>
> OK, here we recover the bit that is only stored in a local variable
> and pass it into cmd_rebase__interactive() machinery via the options
> structure, which lets the codepath after this point oblivious to
> this change, which is good ;-).
>
> >  	if (options.git_am_opts.argc) {
> >  		/* all am options except -q are compatible only with --am */
> > diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
> > index bdaa511bb0..4eff14dae5 100755
> > --- a/t/t3418-rebase-continue.sh
> > +++ b/t/t3418-rebase-continue.sh
> > @@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
> >  	test_i18ngrep "has been rescheduled" err
> >  '
> >
> > +test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
> > +	test_config rebase.reschedulefailedexec true &&
> > +	test_must_fail git rebase -x false HEAD^ &&
>
> These three lines gives us a concise summary of this patch ;-)
>
>  - The test title can serve as a starting point for a much better
>    patch title.
>
>  - We trigger for '-x' without requiring '-i'.

I changed the oneline to

	rebase --am: ignore rebase.reschedulefailedexec

This gives credit to the implementation details, as appropriate for commit
messages, and the error message still tries to be as helpful as possible
for users (who do not necessarily need to know that there are two
backends).

At this point, I am _really_ glad that we only have two backends left (for
all practical purposes, I don't count --preserve-merges).

Ciao,
Dscho

> > +	grep "^exec false" .git/rebase-merge/git-rebase-todo &&
> > +	git rebase --abort &&
> > +	git rebase HEAD^
> > +'
> > +
> >  test_done
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-28 11:49     ` Johannes Schindelin
@ 2019-06-28 13:44       ` Phillip Wood
  2019-06-28 22:08         ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Phillip Wood @ 2019-06-28 13:44 UTC (permalink / raw)
  To: Johannes Schindelin, Junio C Hamano
  Cc: Johannes Schindelin via GitGitGadget, git, Vas Sudanagunta

Hi Junio and Dscho

On 28/06/2019 12:49, Johannes Schindelin wrote:
> Hi Junio,
> 
> On Thu, 27 Jun 2019, Junio C Hamano wrote:
> 
>> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
>> writes:
>>>
>>> -	if (options.reschedule_failed_exec && !is_interactive(&options))
>>> +	if (reschedule_failed_exec > 0 && !is_interactive(&options))
>>
>> OK, it used to be that we got affected by what came from "options",
>> which was read from the configuration.  Now we only pay attention to
>> the command line, which makes sense.
>>
>> At this point, we have already examined '-x' and called
>> imply_interative(), so this should trigger for '-x' (without '-i'),
>> right?
> 
> Yes, at this point we have done all the parsing and automatic implying,
> and check for incompatible options.
> 
>>>   		die(_("--reschedule-failed-exec requires an interactive rebase"));
>>
>> I wonder if users understand that '-x' is "an interctive rebase".
>> The documentation can read both ways, and one of these may want to
>> be clarified.
>>
>> 	-x <cmd>, --exec <cmd>
>> 	...
>> 	This uses the --interactive machinery internally, but it can
>> 	be run without an explicit --interactive.
>>
>> Is it saying that use of interactive machinery is an impelementation
>> detail the users should not concern themselves (in which case, the
>> message given to "die()" above is misleading---not a new problem
>> with this patch, though)?  Is it saying "-x" makes it plenty clear
>> that the user wants interactive behaviour, so the users do not need
>> to spell out --interactive in order to ask for it (in which case,
>> "die()" message is fine, but "... internally, but ..." is
>> misleading)?
> 
> Hmm. What would you think about:
> 
>    		die(_("--reschedule-failed-exec requires --exec or --interactive"));
> 

I was wondering about requiring --exec with --reschedule-failed-exec 
rather than checking is_interactive() as that would be easier to 
understand. One potential problem is if someone has an alias that always 
sets --reschedule-failed-exec but does not always add --exec to the 
command line. We could just emit a warning along the lines of "ignoring 
--reschedule-failed-exec without --exec". I'm not sure that we really 
need to error out, unless we think that the missing --exec is an 
indication that the user forgot --exec and so would not want the rebase 
to start, in which case just dying on --reschedule-failed-exec without 
--exec would be fine.

Best Wishes

Phillip

> 
> It is still not _complete_, but at least it should be a ton less
> confusing.
> 
>>> +	if (reschedule_failed_exec >= 0)
>>> +		options.reschedule_failed_exec = reschedule_failed_exec;
>>
>> OK, here we recover the bit that is only stored in a local variable
>> and pass it into cmd_rebase__interactive() machinery via the options
>> structure, which lets the codepath after this point oblivious to
>> this change, which is good ;-).
>>
>>>   	if (options.git_am_opts.argc) {
>>>   		/* all am options except -q are compatible only with --am */
>>> diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
>>> index bdaa511bb0..4eff14dae5 100755
>>> --- a/t/t3418-rebase-continue.sh
>>> +++ b/t/t3418-rebase-continue.sh
>>> @@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
>>>   	test_i18ngrep "has been rescheduled" err
>>>   '
>>>
>>> +test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
>>> +	test_config rebase.reschedulefailedexec true &&
>>> +	test_must_fail git rebase -x false HEAD^ &&
>>
>> These three lines gives us a concise summary of this patch ;-)
>>
>>   - The test title can serve as a starting point for a much better
>>     patch title.
>>
>>   - We trigger for '-x' without requiring '-i'.
> 
> I changed the oneline to
> 
> 	rebase --am: ignore rebase.reschedulefailedexec
> 
> This gives credit to the implementation details, as appropriate for commit
> messages, and the error message still tries to be as helpful as possible
> for users (who do not necessarily need to know that there are two
> backends).
> 
> At this point, I am _really_ glad that we only have two backends left (for
> all practical purposes, I don't count --preserve-merges).
> 
> Ciao,
> Dscho
> 
>>> +	grep "^exec false" .git/rebase-merge/git-rebase-todo &&
>>> +	git rebase --abort &&
>>> +	git rebase HEAD^
>>> +'
>>> +
>>>   test_done
>>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-28 13:44       ` Phillip Wood
@ 2019-06-28 22:08         ` Junio C Hamano
  2019-06-28 23:52           ` Vas Sudanagunta
                             ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Junio C Hamano @ 2019-06-28 22:08 UTC (permalink / raw)
  To: Phillip Wood
  Cc: Johannes Schindelin, Johannes Schindelin via GitGitGadget, git,
	Vas Sudanagunta

Phillip Wood <phillip.wood123@gmail.com> writes:

>>> I wonder if users understand that '-x' is "an interctive rebase".
>>> The documentation can read both ways, and one of these may want to
>>> be clarified.
>>>
>>> 	-x <cmd>, --exec <cmd>
>>> 	...
>>> 	This uses the --interactive machinery internally, but it can
>>> 	be run without an explicit --interactive.
>>>
>>> Is it saying that use of interactive machinery is an impelementation
>>> detail the users should not concern themselves (in which case, the
>>> message given to "die()" above is misleading---not a new problem
>>> with this patch, though)?  Is it saying "-x" makes it plenty clear
>>> that the user wants interactive behaviour, so the users do not need
>>> to spell out --interactive in order to ask for it (in which case,
>>> "die()" message is fine, but "... internally, but ..." is
>>> misleading)?
>>
>> Hmm. What would you think about:
>>
>>    		die(_("--reschedule-failed-exec requires --exec or --interactive"));

I was leaning towards admitting that the use of the interactive
machinery in "-x" is not merely an implementation detail and fixing
the documentation, leaving the die() message in the patch as-is.

But ...

> I was wondering about requiring --exec with --reschedule-failed-exec
> rather than checking is_interactive() as that would be easier to
> understand.

... I find this a reasonable way to think about the issue.  The
option only matters when we are doing "--exec".  And the usual
convenience measure we'd use, i.e. with --reschedule-failed-exec we
consider that we are implicitly in --exec mode, would not work
because there is no default "command" to be executed.

> One potential problem is if someone has an alias that
> always sets --reschedule-failed-exec but does not always add --exec to
> the command line.

Such a use case would be hitting this die() already without this
topic, wouldn't it?  In which case we can say there is no "someone"
with such an alias.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-28 22:08         ` Junio C Hamano
@ 2019-06-28 23:52           ` Vas Sudanagunta
  2019-06-30 10:03           ` Phillip Wood
                             ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Vas Sudanagunta @ 2019-06-28 23:52 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Phillip Wood, Johannes Schindelin,
	Johannes Schindelin via GitGitGadget, git

Hi, original reporter of the issue here. Some thoughts from a user perspective, from outside the black box of “the machinery":


It seems unintuitive that including a command to execute between each rebase merge implies an interactive rebase. It’s no more interactive than a sequence of rebase merges without intervening commands. A command failure interrupts a rebase just as a merge conflict does. If the fact that a rebase can be interrupts mid-sequence, then all rebases are interactive. 

The intuitive behavior for “rebase.reschedulefailedexec” is that it has no impact if nothing is scheduled.  It has nothing to do with interactivity. 

vas



On Jun 28, 2019, at 6:08 PM, Junio C Hamano <gitster@pobox.com> wrote:

Phillip Wood <phillip.wood123@gmail.com> writes:

>>> I wonder if users understand that '-x' is "an interctive rebase".
>>> The documentation can read both ways, and one of these may want to
>>> be clarified.
>>> 
>>> 	-x <cmd>, --exec <cmd>
>>> 	...
>>> 	This uses the --interactive machinery internally, but it can
>>> 	be run without an explicit --interactive.
>>> 
>>> Is it saying that use of interactive machinery is an impelementation
>>> detail the users should not concern themselves (in which case, the
>>> message given to "die()" above is misleading---not a new problem
>>> with this patch, though)?  Is it saying "-x" makes it plenty clear
>>> that the user wants interactive behaviour, so the users do not need
>>> to spell out --interactive in order to ask for it (in which case,
>>> "die()" message is fine, but "... internally, but ..." is
>>> misleading)?
>> 
>> Hmm. What would you think about:
>> 
>>   		die(_("--reschedule-failed-exec requires --exec or --interactive"));

I was leaning towards admitting that the use of the interactive
machinery in "-x" is not merely an implementation detail and fixing
the documentation, leaving the die() message in the patch as-is.

But ...

> I was wondering about requiring --exec with --reschedule-failed-exec
> rather than checking is_interactive() as that would be easier to
> understand.

... I find this a reasonable way to think about the issue.  The
option only matters when we are doing "--exec".  And the usual
convenience measure we'd use, i.e. with --reschedule-failed-exec we
consider that we are implicitly in --exec mode, would not work
because there is no default "command" to be executed.

> One potential problem is if someone has an alias that
> always sets --reschedule-failed-exec but does not always add --exec to
> the command line.

Such a use case would be hitting this die() already without this
topic, wouldn't it?  In which case we can say there is no "someone"
with such an alias.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-28 22:08         ` Junio C Hamano
  2019-06-28 23:52           ` Vas Sudanagunta
@ 2019-06-30 10:03           ` Phillip Wood
  2019-07-01 11:52             ` Johannes Schindelin
       [not found]           ` <0F745CE4-3203-4447-B1D5-937CCDCC64C7@commonkarma.org>
  2019-07-01 11:49           ` Johannes Schindelin
  3 siblings, 1 reply; 13+ messages in thread
From: Phillip Wood @ 2019-06-30 10:03 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Schindelin, Johannes Schindelin via GitGitGadget, git,
	Vas Sudanagunta

On 28/06/2019 23:08, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>>>> I wonder if users understand that '-x' is "an interctive rebase".
>>>> The documentation can read both ways, and one of these may want to
>>>> be clarified.
>>>>
>>>> 	-x <cmd>, --exec <cmd>
>>>> 	...
>>>> 	This uses the --interactive machinery internally, but it can
>>>> 	be run without an explicit --interactive.
>>>>
>>>> Is it saying that use of interactive machinery is an impelementation
>>>> detail the users should not concern themselves (in which case, the
>>>> message given to "die()" above is misleading---not a new problem
>>>> with this patch, though)?  Is it saying "-x" makes it plenty clear
>>>> that the user wants interactive behaviour, so the users do not need
>>>> to spell out --interactive in order to ask for it (in which case,
>>>> "die()" message is fine, but "... internally, but ..." is
>>>> misleading)?
>>>
>>> Hmm. What would you think about:
>>>
>>>     		die(_("--reschedule-failed-exec requires --exec or --interactive"));
> 
> I was leaning towards admitting that the use of the interactive
> machinery in "-x" is not merely an implementation detail and fixing
> the documentation, leaving the die() message in the patch as-is.

I'd really like to try and hide that as much as possible from users - 
it's just confusing. (though sometimes we can't)
> But ...
> 
>> I was wondering about requiring --exec with --reschedule-failed-exec
>> rather than checking is_interactive() as that would be easier to
>> understand.
> 
> ... I find this a reasonable way to think about the issue.  The
> option only matters when we are doing "--exec".  And the usual
> convenience measure we'd use, i.e. with --reschedule-failed-exec we
> consider that we are implicitly in --exec mode, would not work
> because there is no default "command" to be executed.
 >
>> One potential problem is if someone has an alias that
>> always sets --reschedule-failed-exec but does not always add --exec to
>> the command line.
> 
> Such a use case would be hitting this die() already without this
> topic, wouldn't it?  In which case we can say there is no "someone"
> with such an alias.

It depends what else the alias includes, if it also includes 
-i/-k/-r/--signoff then it wont have been dying but will if we start 
requiring --exec and they don't set that.

Best Wishes

Phillip

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
       [not found]           ` <0F745CE4-3203-4447-B1D5-937CCDCC64C7@commonkarma.org>
@ 2019-07-01 11:48             ` Johannes Schindelin
  0 siblings, 0 replies; 13+ messages in thread
From: Johannes Schindelin @ 2019-07-01 11:48 UTC (permalink / raw)
  To: Vas Sudanagunta
  Cc: Junio C Hamano, Phillip Wood,
	Johannes Schindelin via GitGitGadget, git

[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

Hi,

On Fri, 28 Jun 2019, Vas Sudanagunta wrote:

> It seems unintuitive that including a command to execute between each
> rebase merge implies an interactive rebase. It’s no more interactive
> than a sequence of rebase merges without intervening commands. A command
> failure interrupts a rebase just as a merge conflict does. If the fact
> that a rebase can be interrupts mid-sequence, then all rebases are
> interactive.

Indeed. I would consider it an implementation detail that the `--exec`
option uses the interactive rebase backend, and I would hate to force
users to know about this.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-28 22:08         ` Junio C Hamano
                             ` (2 preceding siblings ...)
       [not found]           ` <0F745CE4-3203-4447-B1D5-937CCDCC64C7@commonkarma.org>
@ 2019-07-01 11:49           ` Johannes Schindelin
  3 siblings, 0 replies; 13+ messages in thread
From: Johannes Schindelin @ 2019-07-01 11:49 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Phillip Wood, Johannes Schindelin via GitGitGadget, git,
	Vas Sudanagunta

Hi,

On Fri, 28 Jun 2019, Junio C Hamano wrote:

> Phillip Wood <phillip.wood123@gmail.com> writes:
>
> > I was wondering about requiring --exec with --reschedule-failed-exec
> > rather than checking is_interactive() as that would be easier to
> > understand.
>
> ... I find this a reasonable way to think about the issue.

I don't: the `exec` command in interactive rebases' todo lists predates
the `--exec` option by quite some time IIRC.

In other words, `--reschedule-failed-exec` can very well influence a `git
rebase -i` without `--exec`.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases
  2019-06-30 10:03           ` Phillip Wood
@ 2019-07-01 11:52             ` Johannes Schindelin
  0 siblings, 0 replies; 13+ messages in thread
From: Johannes Schindelin @ 2019-07-01 11:52 UTC (permalink / raw)
  To: phillip.wood
  Cc: Junio C Hamano, Johannes Schindelin via GitGitGadget, git,
	Vas Sudanagunta

Hi,

On Sun, 30 Jun 2019, Phillip Wood wrote:

> On 28/06/2019 23:08, Junio C Hamano wrote:
> > Phillip Wood <phillip.wood123@gmail.com> writes:
> >
> > > One potential problem is if someone has an alias that always sets
> > > --reschedule-failed-exec but does not always add --exec to the
> > > command line.
> >
> > Such a use case would be hitting this die() already without this
> > topic, wouldn't it?  In which case we can say there is no "someone"
> > with such an alias.
>
> It depends what else the alias includes, if it also includes
> -i/-k/-r/--signoff then it wont have been dying but will if we start
> requiring --exec and they don't set that.

The entire reasoning behind the config variable was that it would allow
changing the behavior just in case that the interactive rebase backend was
in use.

In other words: I tried to introduce that config variable to prevent
people from having afore-mentioned problems with the command-line option.

Therefore, from my perspective, it makes more sense to define such an
alias using `-c ...` than using `--reschedule-failed-exec`, unless the
alias is definitely only intended to launch interactive rebases.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 0/1] Make rebase.reschedulefailedexec less overzealous
  2019-06-27  8:12 [PATCH 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
  2019-06-27  8:12 ` [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases Johannes Schindelin via GitGitGadget
@ 2019-07-01 11:58 ` Johannes Schindelin via GitGitGadget
  2019-07-01 11:58   ` [PATCH v2 1/1] rebase --am: ignore rebase.reschedulefailedexec Johannes Schindelin via GitGitGadget
  1 sibling, 1 reply; 13+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-07-01 11:58 UTC (permalink / raw)
  To: git; +Cc: Vas Sudanagunta, Junio C Hamano

This config setting is pretty useful, but it unfortunately stops all
non-interactive rebases with a bogus error message. This patch fixes that.

Reported via a commit comment on GitHub
[https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187].

Changes since v1:

 * Based on Junio's advice, the commit message was improved considerably.
 * The error message now also mentions --exec, so that users do not have to
   know that --exec implies the interactive backend.

Johannes Schindelin (1):
  rebase --am: ignore rebase.reschedulefailedexec

 builtin/rebase.c           | 10 +++++++---
 t/t3418-rebase-continue.sh |  8 ++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)


base-commit: e11ff8975bedc0aae82632c3cb72578c3d7fc0b2
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-253%2Fdscho%2Freschedule-failed-exec-gently-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-253/dscho/reschedule-failed-exec-gently-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/253

Range-diff vs v1:

 1:  fab124da41 ! 1:  beaeb24bc0 Let rebase.reschedulefailedexec only affect interactive rebases
     @@ -1,9 +1,13 @@
      Author: Johannes Schindelin <johannes.schindelin@gmx.de>
      
     -    Let rebase.reschedulefailedexec only affect interactive rebases
     +    rebase --am: ignore rebase.reschedulefailedexec
      
     -    It does not make sense to stop non-interactive rebases when that config
     -    setting is set to `true`.
     +    The `exec` command is specific to the interactive backend, therefore it
     +    does not make sense for non-interactive rebases to heed that config
     +    setting.
     +
     +    We still want to error out if a non-interactive rebase is started with
     +    `--reschedule-failed-exec`, of course.
      
          Reported by Vas Sudanagunta via:
          https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187
     @@ -35,8 +39,10 @@
       	}
       
      -	if (options.reschedule_failed_exec && !is_interactive(&options))
     +-		die(_("--reschedule-failed-exec requires an interactive rebase"));
      +	if (reschedule_failed_exec > 0 && !is_interactive(&options))
     - 		die(_("--reschedule-failed-exec requires an interactive rebase"));
     ++		die(_("--reschedule-failed-exec requires "
     ++		      "--exec or --interactive"));
      +	if (reschedule_failed_exec >= 0)
      +		options.reschedule_failed_exec = reschedule_failed_exec;
       

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/1] rebase --am: ignore rebase.reschedulefailedexec
  2019-07-01 11:58 ` [PATCH v2 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
@ 2019-07-01 11:58   ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 13+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-07-01 11:58 UTC (permalink / raw)
  To: git; +Cc: Vas Sudanagunta, Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The `exec` command is specific to the interactive backend, therefore it
does not make sense for non-interactive rebases to heed that config
setting.

We still want to error out if a non-interactive rebase is started with
`--reschedule-failed-exec`, of course.

Reported by Vas Sudanagunta via:
https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin/rebase.c           | 10 +++++++---
 t/t3418-rebase-continue.sh |  8 ++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 4839e52555..b33d7f74d6 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -834,6 +834,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	struct string_list strategy_options = STRING_LIST_INIT_NODUP;
 	struct object_id squash_onto;
 	char *squash_onto_name = NULL;
+	int reschedule_failed_exec = -1;
 	struct option builtin_rebase_options[] = {
 		OPT_STRING(0, "onto", &options.onto_name,
 			   N_("revision"),
@@ -929,7 +930,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		OPT_BOOL(0, "root", &options.root,
 			 N_("rebase all reachable commits up to the root(s)")),
 		OPT_BOOL(0, "reschedule-failed-exec",
-			 &options.reschedule_failed_exec,
+			 &reschedule_failed_exec,
 			 N_("automatically re-schedule any `exec` that fails")),
 		OPT_END(),
 	};
@@ -1227,8 +1228,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (options.reschedule_failed_exec && !is_interactive(&options))
-		die(_("--reschedule-failed-exec requires an interactive rebase"));
+	if (reschedule_failed_exec > 0 && !is_interactive(&options))
+		die(_("--reschedule-failed-exec requires "
+		      "--exec or --interactive"));
+	if (reschedule_failed_exec >= 0)
+		options.reschedule_failed_exec = reschedule_failed_exec;
 
 	if (options.git_am_opts.argc) {
 		/* all am options except -q are compatible only with --am */
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index bdaa511bb0..4eff14dae5 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -265,4 +265,12 @@ test_expect_success '--reschedule-failed-exec' '
 	test_i18ngrep "has been rescheduled" err
 '
 
+test_expect_success 'rebase.reschedulefailedexec only affects `rebase -i`' '
+	test_config rebase.reschedulefailedexec true &&
+	test_must_fail git rebase -x false HEAD^ &&
+	grep "^exec false" .git/rebase-merge/git-rebase-todo &&
+	git rebase --abort &&
+	git rebase HEAD^
+'
+
 test_done
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-07-01 11:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27  8:12 [PATCH 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
2019-06-27  8:12 ` [PATCH 1/1] Let rebase.reschedulefailedexec only affect interactive rebases Johannes Schindelin via GitGitGadget
2019-06-27 18:32   ` Junio C Hamano
2019-06-28 11:49     ` Johannes Schindelin
2019-06-28 13:44       ` Phillip Wood
2019-06-28 22:08         ` Junio C Hamano
2019-06-28 23:52           ` Vas Sudanagunta
2019-06-30 10:03           ` Phillip Wood
2019-07-01 11:52             ` Johannes Schindelin
     [not found]           ` <0F745CE4-3203-4447-B1D5-937CCDCC64C7@commonkarma.org>
2019-07-01 11:48             ` Johannes Schindelin
2019-07-01 11:49           ` Johannes Schindelin
2019-07-01 11:58 ` [PATCH v2 0/1] Make rebase.reschedulefailedexec less overzealous Johannes Schindelin via GitGitGadget
2019-07-01 11:58   ` [PATCH v2 1/1] rebase --am: ignore rebase.reschedulefailedexec Johannes Schindelin via GitGitGadget

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).