Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
@ 2020-10-12 23:49 Samuel Čavoj
  2020-10-12 23:49 ` [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge Samuel Čavoj
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Samuel Čavoj @ 2020-10-12 23:49 UTC (permalink / raw)
  To: git, Junio C Hamano
  Cc: Phillip Wood, brian m. carlson, Johannes Schindelin, Samuel Čavoj

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

When performing a rebase with --rebase-merges using either a custom
strategy specified with -s or an octopus merge, and at the same time
having gpgsign enabled (either rebase -S or config commit.gpgsign), the
operation would fail on making the merge commit. Instead of "-S%s" with
the key id substituted, only the bare key id would get passed to the
underlying merge command, which tried to interpret it as a ref.

Fix the issue and add a test case as suggested by Johannes Schindelin.

Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
---
changed v1 -> v2:
    added test case
---
 sequencer.c                | 2 +-
 t/t3435-rebase-gpg-sign.sh | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index 00acb12496..88ccff4838 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
 		strvec_push(&cmd.args, "-F");
 		strvec_push(&cmd.args, git_path_merge_msg(r));
 		if (opts->gpg_sign)
-			strvec_push(&cmd.args, opts->gpg_sign);
+			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
 
 		/* Add the tips to be merged */
 		for (j = to_merge; j; j = j->next)
diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
index b47c59c190..f70b280f5c 100755
--- a/t/t3435-rebase-gpg-sign.sh
+++ b/t/t3435-rebase-gpg-sign.sh
@@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
 	test_must_fail git verify-commit HEAD
 '
 
+test_expect_success 'rebase -r, GPG and merge strategies' '
+	git reset --hard merged &&
+	git rebase -fr --gpg-sign -s resolve --root &&
+	git verify-commit HEAD
+'
+
 test_done
-- 
2.28.0


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

* [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge
  2020-10-12 23:49 [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
@ 2020-10-12 23:49 ` Samuel Čavoj
  2020-10-13  4:46   ` Junio C Hamano
  2020-10-13 10:03   ` Phillip Wood
  2020-10-12 23:52 ` [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 18+ messages in thread
From: Samuel Čavoj @ 2020-10-12 23:49 UTC (permalink / raw)
  To: git, Junio C Hamano
  Cc: Phillip Wood, brian m. carlson, Johannes Schindelin, Samuel Čavoj

The merge subcommand launched for merges with non-default strategy would
use its own default behaviour to decide how to sign commits, regardless
of what opts->gpg_sign was set to. For example the --no-gpg-sign flag
given to rebase explicitly would get ignored, if commit.gpgsign was set
to true.

Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
---
 sequencer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sequencer.c b/sequencer.c
index 88ccff4838..043d606829 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3678,6 +3678,8 @@ static int do_merge(struct repository *r,
 		strvec_push(&cmd.args, git_path_merge_msg(r));
 		if (opts->gpg_sign)
 			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
+		else
+			strvec_push(&cmd.args, "--no-gpg-sign");
 
 		/* Add the tips to be merged */
 		for (j = to_merge; j; j = j->next)
-- 
2.28.0


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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-12 23:49 [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
  2020-10-12 23:49 ` [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge Samuel Čavoj
@ 2020-10-12 23:52 ` Samuel Čavoj
  2020-10-13  9:55 ` Phillip Wood
  2020-10-13 10:02 ` Phillip Wood
  3 siblings, 0 replies; 18+ messages in thread
From: Samuel Čavoj @ 2020-10-12 23:52 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Phillip Wood, brian m. carlson, Johannes Schindelin

On 13.10.2020 01:49, Samuel Čavoj wrote:
> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Oh boy, I left in a line by accident. Please remove this before
applying, unless a v3 comes around. Sorry about that.

> 
> When performing a rebase with --rebase-merges using either a custom
> strategy specified with -s or an octopus merge, and at the same time
> having gpgsign enabled (either rebase -S or config commit.gpgsign), the
> operation would fail on making the merge commit. Instead of "-S%s" with
> the key id substituted, only the bare key id would get passed to the
> underlying merge command, which tried to interpret it as a ref.
> 
> Fix the issue and add a test case as suggested by Johannes Schindelin.
> 
> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> ---
> changed v1 -> v2:
>     added test case
> ---
>  sequencer.c                | 2 +-
>  t/t3435-rebase-gpg-sign.sh | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 00acb12496..88ccff4838 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
>  		strvec_push(&cmd.args, "-F");
>  		strvec_push(&cmd.args, git_path_merge_msg(r));
>  		if (opts->gpg_sign)
> -			strvec_push(&cmd.args, opts->gpg_sign);
> +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
>  
>  		/* Add the tips to be merged */
>  		for (j = to_merge; j; j = j->next)
> diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
> index b47c59c190..f70b280f5c 100755
> --- a/t/t3435-rebase-gpg-sign.sh
> +++ b/t/t3435-rebase-gpg-sign.sh
> @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
>  	test_must_fail git verify-commit HEAD
>  '
>  
> +test_expect_success 'rebase -r, GPG and merge strategies' '
> +	git reset --hard merged &&
> +	git rebase -fr --gpg-sign -s resolve --root &&
> +	git verify-commit HEAD
> +'
> +
>  test_done
> -- 
> 2.28.0
> 

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

* Re: [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge
  2020-10-12 23:49 ` [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge Samuel Čavoj
@ 2020-10-13  4:46   ` Junio C Hamano
  2020-10-13 10:03   ` Phillip Wood
  1 sibling, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2020-10-13  4:46 UTC (permalink / raw)
  To: Samuel Čavoj
  Cc: git, Phillip Wood, brian m. carlson, Johannes Schindelin

Samuel Čavoj <samuel@cavoj.net> writes:

> The merge subcommand launched for merges with non-default strategy would
> use its own default behaviour to decide how to sign commits, regardless
> of what opts->gpg_sign was set to. For example the --no-gpg-sign flag
> given to rebase explicitly would get ignored, if commit.gpgsign was set
> to true.
>
> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> ---
>  sequencer.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/sequencer.c b/sequencer.c
> index 88ccff4838..043d606829 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3678,6 +3678,8 @@ static int do_merge(struct repository *r,
>  		strvec_push(&cmd.args, git_path_merge_msg(r));
>  		if (opts->gpg_sign)
>  			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
> +		else
> +			strvec_push(&cmd.args, "--no-gpg-sign");
>  
>  		/* Add the tips to be merged */
>  		for (j = to_merge; j; j = j->next)

A test that passes --no-gpg-sign from the command line (because
commit.gpgsign is set in the repository used in these tests) would
be a good thing to have, next to the test you added in [PATCH 1/2].
You'd want to make sure the command line overrides the configured
default by checking that the resulting history are not signed.

Thanks.


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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-12 23:49 [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
  2020-10-12 23:49 ` [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge Samuel Čavoj
  2020-10-12 23:52 ` [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
@ 2020-10-13  9:55 ` Phillip Wood
  2020-10-13 10:43   ` Samuel Čavoj
  2020-10-13 10:02 ` Phillip Wood
  3 siblings, 1 reply; 18+ messages in thread
From: Phillip Wood @ 2020-10-13  9:55 UTC (permalink / raw)
  To: Samuel Čavoj, git, Junio C Hamano
  Cc: brian m. carlson, Johannes Schindelin

Hi Samuel

Thanks for re-rolling this

On 13/10/2020 00:49, Samuel Čavoj wrote:
> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> 
> When performing a rebase with --rebase-merges using either a custom
> strategy specified with -s or an octopus merge, and at the same time
> having gpgsign enabled (either rebase -S or config commit.gpgsign), the
> operation would fail on making the merge commit.

Small nit-pick: I think it worked fine with if commit.gpgsign was set 
and the user did not pass -S or --no-gpg-sign because merge would sign 
the commits as commit.gpgsign was set, it was only if the user passed a 
gpg signing option to rebase that we had problems. I'm not sure it's 
worth a re-roll just for that though

Best Wishes

Phillip

> Instead of "-S%s" with
> the key id substituted, only the bare key id would get passed to the
> underlying merge command, which tried to interpret it as a ref.
> 
> Fix the issue and add a test case as suggested by Johannes Schindelin.
> 
> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> ---
> changed v1 -> v2:
>      added test case
> ---
>   sequencer.c                | 2 +-
>   t/t3435-rebase-gpg-sign.sh | 6 ++++++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 00acb12496..88ccff4838 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
>   		strvec_push(&cmd.args, "-F");
>   		strvec_push(&cmd.args, git_path_merge_msg(r));
>   		if (opts->gpg_sign)
> -			strvec_push(&cmd.args, opts->gpg_sign);
> +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
>   
>   		/* Add the tips to be merged */
>   		for (j = to_merge; j; j = j->next)
> diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
> index b47c59c190..f70b280f5c 100755
> --- a/t/t3435-rebase-gpg-sign.sh
> +++ b/t/t3435-rebase-gpg-sign.sh
> @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
>   	test_must_fail git verify-commit HEAD
>   '
>   
> +test_expect_success 'rebase -r, GPG and merge strategies' '
> +	git reset --hard merged &&
> +	git rebase -fr --gpg-sign -s resolve --root &&
> +	git verify-commit HEAD
> +'
> +
>   test_done
> 


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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-12 23:49 [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
                   ` (2 preceding siblings ...)
  2020-10-13  9:55 ` Phillip Wood
@ 2020-10-13 10:02 ` Phillip Wood
  2020-10-13 10:51   ` Samuel Čavoj
  2020-10-13 22:06   ` Junio C Hamano
  3 siblings, 2 replies; 18+ messages in thread
From: Phillip Wood @ 2020-10-13 10:02 UTC (permalink / raw)
  To: Samuel Čavoj, git, Junio C Hamano
  Cc: brian m. carlson, Johannes Schindelin

Hi Samuel

On 13/10/2020 00:49, Samuel Čavoj wrote:
> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> 
> When performing a rebase with --rebase-merges using either a custom
> strategy specified with -s or an octopus merge, and at the same time
> having gpgsign enabled (either rebase -S or config commit.gpgsign), the
> operation would fail on making the merge commit. Instead of "-S%s" with
> the key id substituted, only the bare key id would get passed to the
> underlying merge command, which tried to interpret it as a ref.
> 
> Fix the issue and add a test case as suggested by Johannes Schindelin.
> 
> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> ---
> changed v1 -> v2:
>      added test case
> ---
>   sequencer.c                | 2 +-
>   t/t3435-rebase-gpg-sign.sh | 6 ++++++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 00acb12496..88ccff4838 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
>   		strvec_push(&cmd.args, "-F");
>   		strvec_push(&cmd.args, git_path_merge_msg(r));
>   		if (opts->gpg_sign)
> -			strvec_push(&cmd.args, opts->gpg_sign);
> +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
>   
>   		/* Add the tips to be merged */
>   		for (j = to_merge; j; j = j->next)
> diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
> index b47c59c190..f70b280f5c 100755
> --- a/t/t3435-rebase-gpg-sign.sh
> +++ b/t/t3435-rebase-gpg-sign.sh
> @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
>   	test_must_fail git verify-commit HEAD
>   '
>   
> +test_expect_success 'rebase -r, GPG and merge strategies' '
> +	git reset --hard merged &&
> +	git rebase -fr --gpg-sign -s resolve --root &&
> +	git verify-commit HEAD
> +'

Unfortunately I've just noticed that the test above runs

	git config commit.gpgsign true

So this test would pass anyway if merge picks up that config setting. 
The previous test needs to be changed to

	test_config commit.gpgsign true

so that the config setting is cleared when that test finishes. That 
previous test would then be a good template for testing `rebase -r 
--no-gpg-sign` if you wanted to add a test for that to the next patch as 
Junio suggested.

Best Wishes

Phillip

>   test_done
> 


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

* Re: [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge
  2020-10-12 23:49 ` [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge Samuel Čavoj
  2020-10-13  4:46   ` Junio C Hamano
@ 2020-10-13 10:03   ` Phillip Wood
  1 sibling, 0 replies; 18+ messages in thread
From: Phillip Wood @ 2020-10-13 10:03 UTC (permalink / raw)
  To: Samuel Čavoj, git, Junio C Hamano
  Cc: brian m. carlson, Johannes Schindelin

Hi Samuel

On 13/10/2020 00:49, Samuel Čavoj wrote:
> The merge subcommand launched for merges with non-default strategy would
> use its own default behaviour to decide how to sign commits, regardless
> of what opts->gpg_sign was set to. For example the --no-gpg-sign flag
> given to rebase explicitly would get ignored, if commit.gpgsign was set
> to true.

That's a good explanation, thanks very much for adding this patch

Phillip

> 
> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> ---
>   sequencer.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 88ccff4838..043d606829 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3678,6 +3678,8 @@ static int do_merge(struct repository *r,
>   		strvec_push(&cmd.args, git_path_merge_msg(r));
>   		if (opts->gpg_sign)
>   			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
> +		else
> +			strvec_push(&cmd.args, "--no-gpg-sign");
>   
>   		/* Add the tips to be merged */
>   		for (j = to_merge; j; j = j->next)
> 


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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13  9:55 ` Phillip Wood
@ 2020-10-13 10:43   ` Samuel Čavoj
  2020-10-13 13:15     ` Phillip Wood
  0 siblings, 1 reply; 18+ messages in thread
From: Samuel Čavoj @ 2020-10-13 10:43 UTC (permalink / raw)
  To: Phillip Wood; +Cc: git, Junio C Hamano, brian m. carlson

Hi Phillip,

On 13.10.2020 10:55, Phillip Wood wrote:
> Hi Samuel
> 
> Thanks for re-rolling this
> 
> On 13/10/2020 00:49, Samuel Čavoj wrote:
> > From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> > 
> > When performing a rebase with --rebase-merges using either a custom
> > strategy specified with -s or an octopus merge, and at the same time
> > having gpgsign enabled (either rebase -S or config commit.gpgsign), the
> > operation would fail on making the merge commit.
> 
> Small nit-pick: I think it worked fine with if commit.gpgsign was set and
> the user did not pass -S or --no-gpg-sign because merge would sign the
> commits as commit.gpgsign was set, it was only if the user passed a gpg
> signing option to rebase that we had problems. I'm not sure it's worth a
> re-roll just for that though

This is not the case. That's how I encountered the problem initially, I
have commit.gpgsign set to true globally. I ran a rebase -ir, over an
octopus merge and then it would fail with an error in the lines of 'not
something we can merge'. I later found out it didn't happen on my
laptop, where gpgsign is not set, so that's what gave it away. In either
case, I did not pass neither -S nor --no-gpg-sign to rebase.

Yes, _if_ the merge command went through, it would have choosen the
correct signing behaviour (i.e. the default), but the merge died,
because an empty string was being passed to it as one of the commits to
merge.

off-topic p.s.:
My mail server does not currently have a proper rDNS record (yeah yeah,
I know) and for this reason, gmx.net drops my emails unconditionally. As
such, I am unable to send emails directly to Johannes.Schindelin@gmx.de,
without major hackery, anyway. I am dropping him from Cc, as to prevent
sad mailservers. I hope these messages reach him via the mailing list.

Regards,
Samuel

> 
> Best Wishes
> 
> Phillip
> 
> > Instead of "-S%s" with
> > the key id substituted, only the bare key id would get passed to the
> > underlying merge command, which tried to interpret it as a ref.
> > 
> > Fix the issue and add a test case as suggested by Johannes Schindelin.
> > 
> > Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> > ---
> > changed v1 -> v2:
> >      added test case
> > ---
> >   sequencer.c                | 2 +-
> >   t/t3435-rebase-gpg-sign.sh | 6 ++++++
> >   2 files changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/sequencer.c b/sequencer.c
> > index 00acb12496..88ccff4838 100644
> > --- a/sequencer.c
> > +++ b/sequencer.c
> > @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
> >   		strvec_push(&cmd.args, "-F");
> >   		strvec_push(&cmd.args, git_path_merge_msg(r));
> >   		if (opts->gpg_sign)
> > -			strvec_push(&cmd.args, opts->gpg_sign);
> > +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
> >   		/* Add the tips to be merged */
> >   		for (j = to_merge; j; j = j->next)
> > diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
> > index b47c59c190..f70b280f5c 100755
> > --- a/t/t3435-rebase-gpg-sign.sh
> > +++ b/t/t3435-rebase-gpg-sign.sh
> > @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
> >   	test_must_fail git verify-commit HEAD
> >   '
> > +test_expect_success 'rebase -r, GPG and merge strategies' '
> > +	git reset --hard merged &&
> > +	git rebase -fr --gpg-sign -s resolve --root &&
> > +	git verify-commit HEAD
> > +'
> > +
> >   test_done
> > 
> 

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 10:02 ` Phillip Wood
@ 2020-10-13 10:51   ` Samuel Čavoj
  2020-10-13 13:28     ` Phillip Wood
  2020-10-13 22:06   ` Junio C Hamano
  1 sibling, 1 reply; 18+ messages in thread
From: Samuel Čavoj @ 2020-10-13 10:51 UTC (permalink / raw)
  To: Phillip Wood; +Cc: git, Junio C Hamano, brian m. carlson

Hi Phillip,

thank you very much for the feedback.

On 13.10.2020 11:02, Phillip Wood wrote:
> Hi Samuel
> 
> On 13/10/2020 00:49, Samuel Čavoj wrote:
> > From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> > 
> > When performing a rebase with --rebase-merges using either a custom
> > strategy specified with -s or an octopus merge, and at the same time
> > having gpgsign enabled (either rebase -S or config commit.gpgsign), the
> > operation would fail on making the merge commit. Instead of "-S%s" with
> > the key id substituted, only the bare key id would get passed to the
> > underlying merge command, which tried to interpret it as a ref.
> > 
> > Fix the issue and add a test case as suggested by Johannes Schindelin.
> > 
> > Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
> > ---
> > changed v1 -> v2:
> >      added test case
> > ---
> >   sequencer.c                | 2 +-
> >   t/t3435-rebase-gpg-sign.sh | 6 ++++++
> >   2 files changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/sequencer.c b/sequencer.c
> > index 00acb12496..88ccff4838 100644
> > --- a/sequencer.c
> > +++ b/sequencer.c
> > @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
> >   		strvec_push(&cmd.args, "-F");
> >   		strvec_push(&cmd.args, git_path_merge_msg(r));
> >   		if (opts->gpg_sign)
> > -			strvec_push(&cmd.args, opts->gpg_sign);
> > +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
> >   		/* Add the tips to be merged */
> >   		for (j = to_merge; j; j = j->next)
> > diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
> > index b47c59c190..f70b280f5c 100755
> > --- a/t/t3435-rebase-gpg-sign.sh
> > +++ b/t/t3435-rebase-gpg-sign.sh
> > @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
> >   	test_must_fail git verify-commit HEAD
> >   '
> > +test_expect_success 'rebase -r, GPG and merge strategies' '
> > +	git reset --hard merged &&
> > +	git rebase -fr --gpg-sign -s resolve --root &&
> > +	git verify-commit HEAD
> > +'
> 
> Unfortunately I've just noticed that the test above runs
> 
> 	git config commit.gpgsign true
> 
> So this test would pass anyway if merge picks up that config setting. The
> previous test needs to be changed to
> 
> 	test_config commit.gpgsign true

Should I do that now, maybe as a separate part of the patch series? Or
just override the config with a `test_config commit.gpgsign false` in
the test I added?

There is another usage of `git config` in the file, in the
test_rebase_gpg_sign function. 

> 
> so that the config setting is cleared when that test finishes. That previous
> test would then be a good template for testing `rebase -r --no-gpg-sign` if
> you wanted to add a test for that to the next patch as Junio suggested.

Yes, I will definitely do that in v3. Also, the previous test is expect_failure,
that means its a known bug?

Regards,
Samuel

> 
> Best Wishes
> 
> Phillip
> 
> >   test_done
> > 
> 

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 10:43   ` Samuel Čavoj
@ 2020-10-13 13:15     ` Phillip Wood
  0 siblings, 0 replies; 18+ messages in thread
From: Phillip Wood @ 2020-10-13 13:15 UTC (permalink / raw)
  To: Samuel Čavoj; +Cc: git, Junio C Hamano, brian m. carlson

Hi Samuel

On 13/10/2020 11:43, Samuel Čavoj wrote:
> Hi Phillip,
> 
> On 13.10.2020 10:55, Phillip Wood wrote:
>> Hi Samuel
>>
>> Thanks for re-rolling this
>>
>> On 13/10/2020 00:49, Samuel Čavoj wrote:
>>> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>>>
>>> When performing a rebase with --rebase-merges using either a custom
>>> strategy specified with -s or an octopus merge, and at the same time
>>> having gpgsign enabled (either rebase -S or config commit.gpgsign), the
>>> operation would fail on making the merge commit.
>>
>> Small nit-pick: I think it worked fine with if commit.gpgsign was set and
>> the user did not pass -S or --no-gpg-sign because merge would sign the
>> commits as commit.gpgsign was set, it was only if the user passed a gpg
>> signing option to rebase that we had problems. I'm not sure it's worth a
>> re-roll just for that though
> 
> This is not the case. That's how I encountered the problem initially, I
> have commit.gpgsign set to true globally. I ran a rebase -ir, over an
> octopus merge and then it would fail with an error in the lines of 'not
> something we can merge'. I later found out it didn't happen on my
> laptop, where gpgsign is not set, so that's what gave it away. In either
> case, I did not pass neither -S nor --no-gpg-sign to rebase.
> 
> Yes, _if_ the merge command went through, it would have choosen the
> correct signing behaviour (i.e. the default), but the merge died,
> because an empty string was being passed to it as one of the commits to
> merge.

Oh sorry for some reason I thought we just ignored opts->gpg_sign before 
your patch I'd forgotten we actually passed it without the '-S' - thanks 
for correcting me.

> off-topic p.s.:
> My mail server does not currently have a proper rDNS record (yeah yeah,
> I know) and for this reason, gmx.net drops my emails unconditionally.

It was dropping my emails sent from a gmail account a few weeks back

> As
> such, I am unable to send emails directly to Johannes.Schindelin@gmx.de,
> without major hackery, anyway. I am dropping him from Cc, as to prevent
> sad mailservers. I hope these messages reach him via the mailing list.

He's subscribed to the list so hopefully will see them that way

Best Wishes

Phillip

> Regards,
> Samuel
> 
>>
>> Best Wishes
>>
>> Phillip
>>
>>> Instead of "-S%s" with
>>> the key id substituted, only the bare key id would get passed to the
>>> underlying merge command, which tried to interpret it as a ref.
>>>
>>> Fix the issue and add a test case as suggested by Johannes Schindelin.
>>>
>>> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
>>> ---
>>> changed v1 -> v2:
>>>       added test case
>>> ---
>>>    sequencer.c                | 2 +-
>>>    t/t3435-rebase-gpg-sign.sh | 6 ++++++
>>>    2 files changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/sequencer.c b/sequencer.c
>>> index 00acb12496..88ccff4838 100644
>>> --- a/sequencer.c
>>> +++ b/sequencer.c
>>> @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
>>>    		strvec_push(&cmd.args, "-F");
>>>    		strvec_push(&cmd.args, git_path_merge_msg(r));
>>>    		if (opts->gpg_sign)
>>> -			strvec_push(&cmd.args, opts->gpg_sign);
>>> +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
>>>    		/* Add the tips to be merged */
>>>    		for (j = to_merge; j; j = j->next)
>>> diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
>>> index b47c59c190..f70b280f5c 100755
>>> --- a/t/t3435-rebase-gpg-sign.sh
>>> +++ b/t/t3435-rebase-gpg-sign.sh
>>> @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
>>>    	test_must_fail git verify-commit HEAD
>>>    '
>>> +test_expect_success 'rebase -r, GPG and merge strategies' '
>>> +	git reset --hard merged &&
>>> +	git rebase -fr --gpg-sign -s resolve --root &&
>>> +	git verify-commit HEAD
>>> +'
>>> +
>>>    test_done
>>>
>>

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 10:51   ` Samuel Čavoj
@ 2020-10-13 13:28     ` Phillip Wood
  0 siblings, 0 replies; 18+ messages in thread
From: Phillip Wood @ 2020-10-13 13:28 UTC (permalink / raw)
  To: Samuel Čavoj; +Cc: git, Junio C Hamano, brian m. carlson

Hi Samuel

On 13/10/2020 11:51, Samuel Čavoj wrote:
> Hi Phillip,
> 
> thank you very much for the feedback.
> 
> On 13.10.2020 11:02, Phillip Wood wrote:
>> Hi Samuel
>>
>> On 13/10/2020 00:49, Samuel Čavoj wrote:
>>> From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>>>
>>> When performing a rebase with --rebase-merges using either a custom
>>> strategy specified with -s or an octopus merge, and at the same time
>>> having gpgsign enabled (either rebase -S or config commit.gpgsign), the
>>> operation would fail on making the merge commit. Instead of "-S%s" with
>>> the key id substituted, only the bare key id would get passed to the
>>> underlying merge command, which tried to interpret it as a ref.
>>>
>>> Fix the issue and add a test case as suggested by Johannes Schindelin.
>>>
>>> Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
>>> ---
>>> changed v1 -> v2:
>>>       added test case
>>> ---
>>>    sequencer.c                | 2 +-
>>>    t/t3435-rebase-gpg-sign.sh | 6 ++++++
>>>    2 files changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/sequencer.c b/sequencer.c
>>> index 00acb12496..88ccff4838 100644
>>> --- a/sequencer.c
>>> +++ b/sequencer.c
>>> @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r,
>>>    		strvec_push(&cmd.args, "-F");
>>>    		strvec_push(&cmd.args, git_path_merge_msg(r));
>>>    		if (opts->gpg_sign)
>>> -			strvec_push(&cmd.args, opts->gpg_sign);
>>> +			strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign);
>>>    		/* Add the tips to be merged */
>>>    		for (j = to_merge; j; j = j->next)
>>> diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
>>> index b47c59c190..f70b280f5c 100755
>>> --- a/t/t3435-rebase-gpg-sign.sh
>>> +++ b/t/t3435-rebase-gpg-sign.sh
>>> @@ -68,4 +68,10 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' '
>>>    	test_must_fail git verify-commit HEAD
>>>    '
>>> +test_expect_success 'rebase -r, GPG and merge strategies' '
>>> +	git reset --hard merged &&
>>> +	git rebase -fr --gpg-sign -s resolve --root &&
>>> +	git verify-commit HEAD
>>> +'
>>
>> Unfortunately I've just noticed that the test above runs
>>
>> 	git config commit.gpgsign true
>>
>> So this test would pass anyway if merge picks up that config setting.

That's predicated on my misunderstanding of the behavior without your 
patch but it would be good to fix the test anyway

>> The
>> previous test needs to be changed to
>>
>> 	test_config commit.gpgsign true
> 
> Should I do that now, maybe as a separate part of the patch series? Or
> just override the config with a `test_config commit.gpgsign false` in
> the test I added?

As you've found another instance that needs changing it would probably 
be better as a separate patch

> There is another usage of `git config` in the file, in the
> test_rebase_gpg_sign function.

Well spotted, that should be changed as well

>> so that the config setting is cleared when that test finishes. That previous
>> test would then be a good template for testing `rebase -r --no-gpg-sign` if
>> you wanted to add a test for that to the next patch as Junio suggested.
> 
> Yes, I will definitely do that in v3.

Thanks

> Also, the previous test is expect_failure,
> that means its a known bug?

Yes, `rebase -p` is deprecated and it looks like it was skipped by the 
recent fix for `rebase --no-gpg-sign` in c241371c04 ("rebase.c: honour 
--no-gpg-sign", 2020-04-03)


Best Wishes

Phillip

> Regards,
> Samuel
> 
>>
>> Best Wishes
>>
>> Phillip
>>
>>>    test_done
>>>
>>

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 10:02 ` Phillip Wood
  2020-10-13 10:51   ` Samuel Čavoj
@ 2020-10-13 22:06   ` Junio C Hamano
  2020-10-13 23:45     ` Samuel Čavoj
  2020-10-16 13:40     ` Phillip Wood
  1 sibling, 2 replies; 18+ messages in thread
From: Junio C Hamano @ 2020-10-13 22:06 UTC (permalink / raw)
  To: Phillip Wood
  Cc: Samuel Čavoj, git, brian m. carlson, Johannes Schindelin

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

>>   +test_expect_success 'rebase -r, GPG and merge strategies' '
>> +	git reset --hard merged &&
>> +	git rebase -fr --gpg-sign -s resolve --root &&
>> +	git verify-commit HEAD
>> +'
>
> Unfortunately I've just noticed that the test above runs
>
> 	git config commit.gpgsign true
>
> So this test would pass anyway if merge picks up that config
> setting. The previous test needs to be changed to
>
> 	test_config commit.gpgsign true
>
> so that the config setting is cleared when that test finishes.

Thanks for a review, but I do not think that is a right way to go.

test_config has an inherent assumption that not having the config at
all is somehow the "natural" state, and if that holds true, that
would be OK.  But what is "natural" is subjective X-<.

The way each test is run by calling test_rebase_gpg_sign repeatedly
uses a different and more robust approach to ensure that previous
test does not affect the current one.  Each invocation of test
explicitly sets the configuration to the state the test wants to,
cancelling what the previous test did.

To blend in better with existing tests and match their robustness
expectations, the right fix is for this new test to explicitly use
"git config --set" or "git config --unset" to make the variable into
the desired state, regardless of what the previous tests did.  

If the test quoted at the beginning of this message wants to make
sure that --gpg-sign from the command line takes effect without
commit.gpgsign set, it should unset the variable explicitly.
Another combination worth testing is to ensure that --gpg-sign takes
effect when commit.gpgsign is explicitly set to false (not "left
unset").

Thanks.




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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 22:06   ` Junio C Hamano
@ 2020-10-13 23:45     ` Samuel Čavoj
  2020-10-14 15:31       ` Junio C Hamano
  2020-10-16 13:40     ` Phillip Wood
  1 sibling, 1 reply; 18+ messages in thread
From: Samuel Čavoj @ 2020-10-13 23:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Phillip Wood, git, brian m. carlson, Johannes Schindelin

Hi,

On 13.10.2020 15:06, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
> >>   +test_expect_success 'rebase -r, GPG and merge strategies' '
> >> +	git reset --hard merged &&
> >> +	git rebase -fr --gpg-sign -s resolve --root &&
> >> +	git verify-commit HEAD
> >> +'
> >
> > Unfortunately I've just noticed that the test above runs
> >
> > 	git config commit.gpgsign true
> >
> > So this test would pass anyway if merge picks up that config
> > setting. The previous test needs to be changed to
> >
> > 	test_config commit.gpgsign true
> >
> > so that the config setting is cleared when that test finishes.
> 
> Thanks for a review, but I do not think that is a right way to go.
> 
> test_config has an inherent assumption that not having the config at
> all is somehow the "natural" state, and if that holds true, that
> would be OK.  But what is "natural" is subjective X-<.
> 
> The way each test is run by calling test_rebase_gpg_sign repeatedly
> uses a different and more robust approach to ensure that previous
> test does not affect the current one.  Each invocation of test
> explicitly sets the configuration to the state the test wants to,
> cancelling what the previous test did.
> 
> To blend in better with existing tests and match their robustness
> expectations, the right fix is for this new test to explicitly use
> "git config --set" or "git config --unset" to make the variable into
> the desired state, regardless of what the previous tests did.  

This is more or less what I did in v3, although not completely
comprehensively. Of course, the test_rebase_gpg_sign function could be
either duplicated or modified to be more generic in order to accommodate
all combinations for the new tests, though I considered this not worth
doing. I am open to it, however.

I'm unfamiliar with the git codebase and the testing practices, so a
little hand-holding might be needed, I hope that's not a bother for you.

In addition, I have replaced `git config` usages with `test_config`, not
sure if that should be reverted -- I see no harm in using it, and I
guess it is slightly more explicit.

Speaking of v3, I pulled the trigger a little too fast on that one,
should have waited a little longer for feedback. Sorry about that.

Though, I am not sure what has happened to it. I sent it out in the
usual manner, but it hasn't appeared in any of the mailing list
archives. Can you please confirm (or deny) that you have received it?
In case not, should I just send it again, with the same Message-Id's?
All the recipient mail servers responded with a 250 Ok from my postfix
logs.

Thank you for all the help.

Regards,
Samuel

> 
> If the test quoted at the beginning of this message wants to make
> sure that --gpg-sign from the command line takes effect without
> commit.gpgsign set, it should unset the variable explicitly.
> Another combination worth testing is to ensure that --gpg-sign takes
> effect when commit.gpgsign is explicitly set to false (not "left
> unset").
> 
> Thanks.
> 

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 23:45     ` Samuel Čavoj
@ 2020-10-14 15:31       ` Junio C Hamano
  0 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2020-10-14 15:31 UTC (permalink / raw)
  To: Samuel Čavoj
  Cc: Phillip Wood, git, brian m. carlson, Johannes Schindelin

Samuel Čavoj <samuel@cavoj.net> writes:

> Speaking of v3, I pulled the trigger a little too fast on that one,
> should have waited a little longer for feedback. Sorry about that.

Nothing to be sorry about---working asynchronously, mails crossing
and timings not coinciding are just expected parts of life.  It is
the kind of thing participants need to learn to adjust, as "normal
latency" is different from community to community.

> Though, I am not sure what has happened to it. I sent it out in the
> usual manner, but it hasn't appeared in any of the mailing list
> archives. Can you please confirm (or deny) that you have received it?
> In case not, should I just send it again, with the same Message-Id's?
> All the recipient mail servers responded with a 250 Ok from my postfix
> logs.

I see the message I am responding to has a timestamp that is about
16 hours ago (relative to the time I am typing this response), but I
am fairly sure that I didn't see it ten hours ago (i.e. my last
night's final e-mail scanning).

Perhaps there was congestion somewhere that held some messages.

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-13 22:06   ` Junio C Hamano
  2020-10-13 23:45     ` Samuel Čavoj
@ 2020-10-16 13:40     ` Phillip Wood
  2020-10-16 16:37       ` Junio C Hamano
  2020-10-16 20:15       ` Junio C Hamano
  1 sibling, 2 replies; 18+ messages in thread
From: Phillip Wood @ 2020-10-16 13:40 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Samuel Čavoj, git, brian m. carlson, Johannes Schindelin

Hi Junio

It seems to be that the config handling here is another example an 
interdependence between tests that makes life harder for contributors 
and reviewers.

On 13/10/2020 23:06, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>>>    +test_expect_success 'rebase -r, GPG and merge strategies' '
>>> +	git reset --hard merged &&
>>> +	git rebase -fr --gpg-sign -s resolve --root &&
>>> +	git verify-commit HEAD
>>> +'
>>
>> Unfortunately I've just noticed that the test above runs
>>
>> 	git config commit.gpgsign true
>>
>> So this test would pass anyway if merge picks up that config
>> setting. The previous test needs to be changed to
>>
>> 	test_config commit.gpgsign true
>>
>> so that the config setting is cleared when that test finishes.
> 
> Thanks for a review, but I do not think that is a right way to go.
> 
> test_config has an inherent assumption that not having the config at
> all is somehow the "natural" state, and if that holds true, that
> would be OK.  But what is "natural" is subjective X-<.

What is "natural" is subjective but what is the default config is not. 
If test scripts set random config variables and assumes that they will 
be cleared in later tests if they don't want them it makes it very hard 
for contributors and reviewers to check that new tests are sound as they 
have to analyze each existing test in the script. In this example I 
believe the new test was contributed by dscho who is an experienced 
contributor with an interest in the test suite. However the test did not 
clear the relevant config variable - if an experienced contributor did 
not realize that the variable needed to be cleared how are new 
contributors supposed to figure it out? If each test starts with the 
default config it is much easier to reason about it.

> The way each test is run by calling test_rebase_gpg_sign repeatedly
> uses a different and more robust approach to ensure that previous
> test does not affect the current one.  Each invocation of test
> explicitly sets the configuration to the state the test wants to,
> cancelling what the previous test did.

It is only robust if contributors and reviewers realize that is what is 
expected. Reviewers that only read the patch without loading up the test 
file in their editor have no indication that the test should be clearing 
the config variable.

Best Wishes

Phillip

> To blend in better with existing tests and match their robustness
> expectations, the right fix is for this new test to explicitly use
> "git config --set" or "git config --unset" to make the variable into
> the desired state, regardless of what the previous tests did.
> 
> If the test quoted at the beginning of this message wants to make
> sure that --gpg-sign from the command line takes effect without
> commit.gpgsign set, it should unset the variable explicitly.
> Another combination worth testing is to ensure that --gpg-sign takes
> effect when commit.gpgsign is explicitly set to false (not "left
> unset").
> 
> Thanks.
> 
> 
> 


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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-16 13:40     ` Phillip Wood
@ 2020-10-16 16:37       ` Junio C Hamano
  2020-10-16 17:25         ` Phillip Wood
  2020-10-16 20:15       ` Junio C Hamano
  1 sibling, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2020-10-16 16:37 UTC (permalink / raw)
  To: Phillip Wood
  Cc: Samuel Čavoj, git, brian m. carlson, Johannes Schindelin

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

> ... Reviewers that only read the patch without loading up the
> test file in their editor have no indication that the test should be
> clearing the config variable.

It is not a review if the code being updated is not checked for
sanity in its own context, is it?


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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-16 16:37       ` Junio C Hamano
@ 2020-10-16 17:25         ` Phillip Wood
  0 siblings, 0 replies; 18+ messages in thread
From: Phillip Wood @ 2020-10-16 17:25 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Samuel Čavoj, git, brian m. carlson, Johannes Schindelin

On 16/10/2020 17:37, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> ... Reviewers that only read the patch without loading up the
>> test file in their editor have no indication that the test should be
>> clearing the config variable.
> 
> It is not a review if the code being updated is not checked for
> sanity in its own context, is it?

It is disappointing that you have chosen to cut the original to those 
few lines and reply just to them. The original message made the broader 
point that having to check the previous tests in a file to figure out 
what the state is at the beginning of any new test that gets added makes 
life harder than it needs to be both for contributors and reviewers.

Phillip

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

* Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand
  2020-10-16 13:40     ` Phillip Wood
  2020-10-16 16:37       ` Junio C Hamano
@ 2020-10-16 20:15       ` Junio C Hamano
  1 sibling, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2020-10-16 20:15 UTC (permalink / raw)
  To: Phillip Wood
  Cc: Samuel Čavoj, git, brian m. carlson, Johannes Schindelin

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

> What is "natural" is subjective but what is the default config is
> not. If test scripts set random config variables and assumes that they
> will be ...
> ... cleared how are new contributors supposed to figure it out? If each
> test starts with the default config it is much easier to reason about
> it.

If this were a test script with many tests, all of which depend on
starting from clean slate wrt the configuration variable space, and
if you are adding just one or two tests that wants to run with
configuration variable in effect, the story would be quite
different.  For example, I would think it would make a lot of sense
in <20201014232517.3068298-1-emilyshaffer@google.com> to use
test_config instead of "git config" as it is clear that leading 100+
lines of tests run with the default configuration, and it is sane to
expact that later tests that may be added in the future would be the
same.

Look at the test script in question again and notice that it is
about seeing behaviour with the single configuration variable set to
true or false.  Using test_config would still signal the test pieces
that use it do depend on the shown setting of the variable, but it
does not help at all the test pieces that wants to see what happens
when there is no configuration.  Explicitly using "git config" and
"test_unconfig" actually would _help_ reviewers who only looks
between the pre- and post- context lines that are affected by the
patch, as they do not have to know or assume that "normal state is
nothing configured" (which needs to be verified by seeing all the
existing tests that are not shown in the patch use test_config to
clear the setting when they are done).

All of the above would be obvious once you think about it, I'd
think.

Thanks.


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

end of thread, back to index

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 23:49 [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
2020-10-12 23:49 ` [PATCH v2 2/2] sequencer: pass explicit --no-gpg-sign to merge Samuel Čavoj
2020-10-13  4:46   ` Junio C Hamano
2020-10-13 10:03   ` Phillip Wood
2020-10-12 23:52 ` [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand Samuel Čavoj
2020-10-13  9:55 ` Phillip Wood
2020-10-13 10:43   ` Samuel Čavoj
2020-10-13 13:15     ` Phillip Wood
2020-10-13 10:02 ` Phillip Wood
2020-10-13 10:51   ` Samuel Čavoj
2020-10-13 13:28     ` Phillip Wood
2020-10-13 22:06   ` Junio C Hamano
2020-10-13 23:45     ` Samuel Čavoj
2020-10-14 15:31       ` Junio C Hamano
2020-10-16 13:40     ` Phillip Wood
2020-10-16 16:37       ` Junio C Hamano
2020-10-16 17:25         ` Phillip Wood
2020-10-16 20:15       ` Junio C Hamano

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git