summaryrefslogtreecommitdiff
path: root/common-main.c
diff options
context:
space:
mode:
authorDan Jacques <dnj@google.com>2018-03-25 16:51:20 -0400
committerJunio C Hamano <gitster@pobox.com>2018-03-25 22:28:57 -0700
commit0d037507b5969fd72535df0cae4ba33dc17b866d (patch)
tree8813f883c6b7d6b7809e7d73adc680d84e80f065 /common-main.c
parentdeb74577943539b6f151fef130d84ccc37d59a35 (diff)
downloadgit-dj/runtime-prefix.tar.gz
exec_cmd: RUNTIME_PREFIX on some POSIX systemsdj/runtime-prefix
Enable Git to resolve its own binary location using a variety of OS-specific and generic methods, including: - procfs via "/proc/self/exe" (Linux) - _NSGetExecutablePath (Darwin) - KERN_PROC_PATHNAME sysctl on BSDs. - argv0, if absolute (all, including Windows). This is used to enable RUNTIME_PREFIX support for non-Windows systems, notably Linux and Darwin. When configured with RUNTIME_PREFIX, Git will do a best-effort resolution of its executable path and automatically use this as its "exec_path" for relative helper and data lookups, unless explicitly overridden. Small incidental formatting cleanup of "exec_cmd.c". Signed-off-by: Dan Jacques <dnj@google.com> Thanks-to: Robbie Iannucci <iannucci@google.com> Thanks-to: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'common-main.c')
-rw-r--r--common-main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common-main.c b/common-main.c
index 6a689007e7..6516a1f89f 100644
--- a/common-main.c
+++ b/common-main.c
@@ -32,12 +32,12 @@ int main(int argc, const char **argv)
*/
sanitize_stdfds();
+ git_resolve_executable_dir(argv[0]);
+
git_setup_gettext();
attr_start();
- git_extract_argv0_path(argv[0]);
-
restore_sigpipe_to_default();
return cmd_main(argc, argv);