Thread (5 messages) flat view 5 messages, 2 authors, 2016-06-15

Re: [PATCH] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:45:04

Hi,
quoted hunk ↗ jump to hunk
diff --git a/upload-pack.c b/upload-pack.c
index c911e70..086eff6 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -616,6 +616,9 @@ int main(int argc, char **argv)
 	int i;
 	int strict = 0;
 
+	if (argv[0] && *argv[0])
+		git_extract_argv0_path(argv[0]);
+
This is ugly.  The called function should already do it itself.

Further, why not go the full nine yards and avoid the calculation 
altogether, until it is necessary?  Then the change to add 
lookup_program_in_path() would be nice and non-intrusive.

IOW why not leave the function name as-is, and just enhance system_path() 
to have a static variable "initialized", which does the whole calculation? 
I.e. move the calculation from git.c to exec_cmd.c, but at the same time 
do it only when needed.

And your change to set argv0_path from receive-pack and upload-pack would 
be a second patch.

And then the patch to add support to "glean" (did not know that word) the 
path from the PATH (lookup_program_in_path()) could come as a third patch.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help