builtin/send-pack: populate the default configs
PATCH 1/1 builtin/send-pack: populate the default configs
builtin/send-pack didn't call git_default_config, and because of this git push --signed didn't respect the username and email in gitconfig in the HTTP transport.
--- builtin/send-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/send-pack.c +1 -1
@@ -121,7 +121,7 @@ static int send_pack_config(const char *k, const char *v, void *cb) } } } -return 0 ; +return git_default_config (k, v, cb); }int cmd_send_pack (int argc,const char **argv,const char *prefix)
Signature · 1 line
2.18.0.rc1.242.g61856ae69a-goog
Quoted 8 lines · Masaya Suzuki
builtin/send-pack didn't call
git_default_config, and because of this git push --signed didn't respect the username and email in gitconfig in the HTTP transport.Signed-off-by Masaya Suzuki <[email protected]>--- builtin/send-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makes sense. I wonder if this was deliberate (i.e. we had some reason not wanting to be affected by some _other_ configuration items and refraining from doing the default-config was the way to implement it), but I do not think of a reason offhand.
Will queue. Thanks.
Quoted 14 lines
builtin/send-pack.c +1
-1@@ -121,7 +121,7 @@ static int send_pack_config(const char *k, const char *v, void *cb) } } } -return 0 ; +return git_default_config (k, v, cb); }int cmd_send_pack (int argc,const char **argv,const char *prefix)
PATCH 1/1 builtin/send-pack: report gpg config errors
Any caller except of git_gpg_config() except the one in send_pack_config() handles the return value of git_gpg_config(). Also handle the return value there.
---
Quoted 1 line
Makes sense. I wonder if this was deliberate
There was no need for other configuration to be loaded and signing pushes is the first that needs repository configuration.
Looking at 68c757f2199 (push: add a config option push.gpgSign for default signed pushes, 2015-08-19) further, maybe we want to also have this?
Thanks,
Stefan
builtin/send-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
builtin/send-pack.c +2 -1
@@ -101,7 +101,8 @@ static void print_helper_status(struct ref *ref)static int send_pack_config (const char *k,const char *v,void *cb) { -git_gpg_config (k, v,NULL ); +if (git_gpg_config (k, v,NULL ) <0 ) +return -1 ;if (!strcmp (k,"push.gpgsign" )) {const char *value;
Signature · 1 line
2.18.0.rc1.244.gcf134e6275-goog
Re: [PATCH] builtin/send-pack: report gpg config errors
Quoted 1 line · Stefan Beller
Any caller except of
git_gpg_config()except the one insend_pack_config()
Drop the first "except"?
Also: s/Any caller/All callers/
Quoted 4 lines
handles the return value of
git_gpg_config(). Also handle the return value there.Signed-off-by Stefan Beller <[email protected]>
Re: [PATCH] builtin/send-pack: report gpg config errors
In reply to Stefan BellerHi,
Quoted 8 lines · Stefan Beller
Any caller except of
git_gpg_config()except the one insend_pack_config()handles the return value ofgit_gpg_config(). Also handle the return value there.Signed-off-by Stefan Beller <[email protected]>--- builtin/send-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
The other callers do
int status;
if (!strcmp(k, "key.i.handle")) {
...
return ...;
}
return git_gpg_config(k, v, NULL);or
int status;
if (!strcmp(k, "key.i.handle")) {
...
return ...;
}
status = git_gpg_config(k, v, NULL);
if (status)
return status;
...Should this do the same? That way, if config_fn_t learns to return more fine-grained errors (e.g. a new return value of -2 or 1) then it would be propagated.
Thanks,
Jonathan
Re: [PATCH] builtin/send-pack: report gpg config errors
Quoted 9 lines · Jonathan Nieder
Hi,
Quoted 4 lines · Stefan Beller
Any caller except of
git_gpg_config()except the one insend_pack_config()handles the return value ofgit_gpg_config(). Also handle the return value there.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Stefan Beller <[email protected]>--- builtin/send-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)The other callers do
except builtin/log, which I followed. :/
Quoted 8 lines
int status;
if (!strcmp(k, "key.i.handle")) {
...
return ...;
}
return git_gpg_config(k, v, NULL);This conflicts with Masayas patch, that has a return of the standard options.
Quoted 14 lines
or
int status; if (!strcmp(k, "key.i.handle")) { ... return ...; } status = git_gpg_config(k, v, NULL); if (status) return status; ...
This looks like a good idea.
Will send a follow up patch.
Hi,
Quoted 8 lines · Masaya Suzuki
builtin/send-pack didn't call
git_default_config, and because of this git push --signed didn't respect the username and email in gitconfig in the HTTP transport.Signed-off-by Masaya Suzuki <[email protected]>--- builtin/send-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Do you have a set of commands I can run to reproduce this? Bonus points if they're in the form of a patch to t/, but commands I can manually run would be fine, too.
builtin/send-pack.c static int send_pack_config(const char *k, const char *v, void *cb) · line 124
Quoted 8 lines
builtin/send-pack.c +1
-1@@ -121,7 +121,7 @@ static int send_pack_config(const char *k, const char *v, void *cb) } } } -return 0 ; +return git_default_config (k, v, cb);
send-pack is not a command served by a daemon so this is less potentially scary than the corresponding potential change to upload-pack or receive-pack. Some configuration this brings in:
- core.askpass: allows specifying an arbitrary command to use to ask for a password. Respecting this setting should be very useful, even if it would be scary in a daemon.
- core.pager: allows specifying an arbitrary command to use as a pager, if pagination is on (but it shouldn't be on).
- core.logallrefupdates: whether to create reflogs for new refs (including new remote-tracking refs). Good.
- core.abbrev: what length of abbreviations to use when printing abbreviated object ids (good).
- core.compression, core.packedgitwindowsize, etc: pack generation tunables (good).
- advice.*: would allow us to make "git push" produce configurable advice (good!)
- etc
So it looks like a very good change. Thanks for writing it.
Quoted 15 lines · Jonathan Nieder
Quoted 6 lines · Masaya Suzuki
builtin/send-pack didn't call
git_default_config, and because of this git push --signed didn't respect the username and email in gitconfig in the HTTP transport.Signed-off-by Masaya Suzuki <[email protected]>---
send-pack is not a command served by a daemon so this is less potentially scary than the corresponding potential change to upload-pack or receive-pack. Some configuration this brings in:
- core.askpass: allows specifying an arbitrary command to use to ask for a password. Respecting this setting should be very useful, even if it would be scary in a daemon.
Quoted 11 lines
- core.pager: allows specifying an arbitrary command to use as a pager, if pagination is on (but it shouldn't be on).
- core.logallrefupdates: whether to create reflogs for new refs (including new remote-tracking refs). Good.
- core.abbrev: what length of abbreviations to use when printing abbreviated object ids (good).
- core.compression, core.packedgitwindowsize, etc: pack generation tunables (good).
- advice.*: would allow us to make "git push" produce configurable advice (good!)
- etc
This summary probably ought to be in the commit message itself (plus additional commentary implied by the ending "etc."). It's exactly the sort of information someone looking at this patch in the future will want to know to feel assured that such behavior changes were taken into account by the patch author.