diff options
author | Dan Jacques <dnj@google.com> | 2018-04-10 17:05:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-11 11:10:28 +0200 |
commit | 226c0ddd0d63dd6c8dde497c755af2ad1f02e0c1 (patch) | |
tree | 232d124263ccd6aa6370ac0e100c32b68c70fb94 /common-main.c | |
parent | Makefile: add Perl runtime prefix support (diff) | |
download | git-226c0ddd0d63dd6c8dde497c755af2ad1f02e0c1.tar.xz git-226c0ddd0d63dd6c8dde497c755af2ad1f02e0c1.zip |
exec_cmd: RUNTIME_PREFIX on some POSIX systems
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common-main.c b/common-main.c index 7d716d5a54..b2e5a86dff 100644 --- a/common-main.c +++ b/common-main.c @@ -32,14 +32,14 @@ int main(int argc, const char **argv) */ sanitize_stdfds(); + git_resolve_executable_dir(argv[0]); + git_setup_gettext(); initialize_the_repository(); attr_start(); - git_extract_argv0_path(argv[0]); - restore_sigpipe_to_default(); return cmd_main(argc, argv); |