All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] am: configure gpg at startup
@ 2015-09-30 17:49 Renee Margaret McConahy
  2015-09-30 18:53 ` Eric Sunshine
  2015-09-30 19:25 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Renee Margaret McConahy @ 2015-09-30 17:49 UTC (permalink / raw)
  To: git; +Cc: Paul Tan

The new builtin am ignores the user.signingkey variable: gpg is being
called with the committer details as the key ID, which may not be
correct. git_gpg_config is responsible for handling that variable and is
expected to be called on initialization by any modules that use gpg.

Perhaps git_gpg_config's functionality ought to be merged into
git_default_config, but this is simpler and in keeping with the current
practice.

Signed-off-by: Renee Margaret McConahy <nepella@gmail.com>
---
 builtin/am.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/builtin/am.c b/builtin/am.c
index 4f77e07..f0b0ffd 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2208,6 +2208,18 @@ enum resume_mode {
 	RESUME_ABORT
 };
 
+static int git_am_config(const char *k, const char *v, void *cb)
+{
+	int *flags = cb;
+	int status;
+
+	status = git_gpg_config(k, v, NULL);
+	if (status)
+		return status;
+
+	return git_default_config(k, v, NULL);
+}
+
 int cmd_am(int argc, const char **argv, const char *prefix)
 {
 	struct am_state state;
@@ -2308,7 +2320,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
 		OPT_END()
 	};
 
-	git_config(git_default_config, NULL);
+	git_config(git_am_config, NULL);
 
 	am_state_init(&state, git_path("rebase-apply"));
 
-- 
2.6.0

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

* [PATCH v2] am: configure gpg at startup
  2015-09-30 19:25 ` Junio C Hamano
@ 2015-09-30 17:49   ` Renee Margaret McConahy
  0 siblings, 0 replies; 4+ messages in thread
From: Renee Margaret McConahy @ 2015-09-30 17:49 UTC (permalink / raw)
  To: git; +Cc: Paul Tan, Eric Sunshine, Junio C Hamano

The new builtin am ignores the user.signingkey variable: gpg is being
called with the committer details as the key ID, which may not be
correct. git_gpg_config is responsible for handling that variable and is
expected to be called on initialization by any modules that use gpg.

Perhaps git_gpg_config's functionality ought to be merged into
git_default_config, but this is simpler and in keeping with the current
practice.

Signed-off-by: Renee Margaret McConahy <nepella@gmail.com>
---
Oops, my bad. Thanks.

 builtin/am.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/builtin/am.c b/builtin/am.c
index 4f77e07..3bd4fd7 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2208,6 +2208,17 @@ enum resume_mode {
 	RESUME_ABORT
 };
 
+static int git_am_config(const char *k, const char *v, void *cb)
+{
+	int status;
+
+	status = git_gpg_config(k, v, NULL);
+	if (status)
+		return status;
+
+	return git_default_config(k, v, NULL);
+}
+
 int cmd_am(int argc, const char **argv, const char *prefix)
 {
 	struct am_state state;
@@ -2308,7 +2319,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
 		OPT_END()
 	};
 
-	git_config(git_default_config, NULL);
+	git_config(git_am_config, NULL);
 
 	am_state_init(&state, git_path("rebase-apply"));
 
-- 
2.5.3

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

* Re: [PATCH] am: configure gpg at startup
  2015-09-30 17:49 [PATCH] am: configure gpg at startup Renee Margaret McConahy
@ 2015-09-30 18:53 ` Eric Sunshine
  2015-09-30 19:25 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2015-09-30 18:53 UTC (permalink / raw)
  To: Renee Margaret McConahy; +Cc: Git List, Paul Tan

On Wed, Sep 30, 2015 at 1:49 PM, Renee Margaret McConahy
<nepella@gmail.com> wrote:
> The new builtin am ignores the user.signingkey variable: gpg is being
> called with the committer details as the key ID, which may not be
> correct. git_gpg_config is responsible for handling that variable and is
> expected to be called on initialization by any modules that use gpg.
>
> Perhaps git_gpg_config's functionality ought to be merged into
> git_default_config, but this is simpler and in keeping with the current
> practice.
>
> Signed-off-by: Renee Margaret McConahy <nepella@gmail.com>
> ---
> diff --git a/builtin/am.c b/builtin/am.c
> index 4f77e07..f0b0ffd 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -2208,6 +2208,18 @@ enum resume_mode {
>         RESUME_ABORT
>  };
>
> +static int git_am_config(const char *k, const char *v, void *cb)
> +{
> +       int *flags = cb;

'flags' seems to be unused.

> +       int status;
> +
> +       status = git_gpg_config(k, v, NULL);
> +       if (status)
> +               return status;
> +
> +       return git_default_config(k, v, NULL);
> +}
> +
>  int cmd_am(int argc, const char **argv, const char *prefix)
>  {
>         struct am_state state;
> @@ -2308,7 +2320,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
>                 OPT_END()
>         };
>
> -       git_config(git_default_config, NULL);
> +       git_config(git_am_config, NULL);
>
>         am_state_init(&state, git_path("rebase-apply"));
>
> --
> 2.6.0

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

* Re: [PATCH] am: configure gpg at startup
  2015-09-30 17:49 [PATCH] am: configure gpg at startup Renee Margaret McConahy
  2015-09-30 18:53 ` Eric Sunshine
@ 2015-09-30 19:25 ` Junio C Hamano
  2015-09-30 17:49   ` [PATCH v2] " Renee Margaret McConahy
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2015-09-30 19:25 UTC (permalink / raw)
  To: Renee Margaret McConahy; +Cc: git, Paul Tan

Renee Margaret McConahy <nepella@gmail.com> writes:

> The new builtin am ignores the user.signingkey variable: gpg is being
> called with the committer details as the key ID, which may not be
> correct. git_gpg_config is responsible for handling that variable and is
> expected to be called on initialization by any modules that use gpg.
>
> Perhaps git_gpg_config's functionality ought to be merged into
> git_default_config, but this is simpler and in keeping with the current
> practice.
>
> Signed-off-by: Renee Margaret McConahy <nepella@gmail.com>
> ---

Thanks.

I'd remove the unused "flags" (already pointed out by somebody, I
think), but otherwise the change looks sensible.


>  builtin/am.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/am.c b/builtin/am.c
> index 4f77e07..f0b0ffd 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -2208,6 +2208,18 @@ enum resume_mode {
>  	RESUME_ABORT
>  };
>  
> +static int git_am_config(const char *k, const char *v, void *cb)
> +{
> +	int *flags = cb;
> +	int status;
> +
> +	status = git_gpg_config(k, v, NULL);
> +	if (status)
> +		return status;
> +
> +	return git_default_config(k, v, NULL);
> +}
> +
>  int cmd_am(int argc, const char **argv, const char *prefix)
>  {
>  	struct am_state state;
> @@ -2308,7 +2320,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
>  		OPT_END()
>  	};
>  
> -	git_config(git_default_config, NULL);
> +	git_config(git_am_config, NULL);
>  
>  	am_state_init(&state, git_path("rebase-apply"));

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

end of thread, other threads:[~2015-09-30 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 17:49 [PATCH] am: configure gpg at startup Renee Margaret McConahy
2015-09-30 18:53 ` Eric Sunshine
2015-09-30 19:25 ` Junio C Hamano
2015-09-30 17:49   ` [PATCH v2] " Renee Margaret McConahy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.