am: configure gpg at startup

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. Signed-off-by: Renee Margaret McConahy <nepella@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Renee Margaret McConahy committed Sep 30, 2015 at 13:49 UTC 434c64df669284af7e19fafd0ab496bc075cd24b
1 file changed +12 -1
builtin/am.c
+12 -1
@@ -2125,6 +2125,17 @@ enum resume_mode {
2125 RESUME_ABORT
2126 };
2127
2128 +static int git_am_config(const char *k, const char *v, void *cb)
2129 +{
2130 + int status;
2131 +
2132 + status = git_gpg_config(k, v, NULL);
2133 + if (status)
2134 + return status;
2135 +
2136 + return git_default_config(k, v, NULL);
2137 +}
2138 +
2139 int cmd_am(int argc, const char **argv, const char *prefix)
2140 {
2141 struct am_state state;
@@ -2223,7 +2234,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
2234 OPT_END()
2235 };
2236
2226 - git_config(git_default_config, NULL);
2237 + git_config(git_am_config, NULL);
2238
2239 am_state_init(&state, git_path("rebase-apply"));
2240