{"thread":{"id":"18341","subject":"--exec-path not always honored","startedAt":"2009-03-17T09:11:07Z","lastAt":"2009-03-18T07:42:53Z","messageCount":5,"participants":["Johannes Sixt","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"108201","messageId":"49BF692B.9020002@viscovery.net","threadId":"18341","inReplyTo":null,"subject":"--exec-path not always honored","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-17T09:11:07Z","receivedAt":"2009-03-17T09:11:07Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"I noticed this failure if I run git from the build directory:\n\n$ ./git --exec-path=. gc\nusage: git pack-objects [{ -q | --progress | --all-progress }]\n        [--max-pack-size=N] [--local] [--incremental]\n        [--window=N] [--window-memory=N] [--depth=N]\n        [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]\n        [--threads=N] [--non-empty] [--revs [--unpacked | --all]*] [--reflog]\n        [--include-tag] [--keep-unreachable | --unpack-unreachable]\n        --stdout | base-name < ref-or-object-list\nerror: failed to run repack\n\nThe reason is that the version of pack-objects that I have installed in\n$prefix does not know the option --kept-pack-only, which ./git-repack\npasses along. It doesn't matter whether I have $prefix in PATH or not.\n\nBut on the other hand:\n\n$ ./git --exec-path=. repack -a -d\nCounting objects: 104070, done.\nDelta compression using 2 threads.\nCompressing objects: 100% (26161/26161), done.\nWriting objects: 100% (104070/104070), done.\nTotal 104070 (delta 76376), reused 104070 (delta 76376)\n\nworks just fine whereas without --exec-path it fails like git-gc above.\n\ngit-gc is a builtin. Should git setenv(\"GIT_EXEC_PATH\") before it runs\nother git commands?\n\n-- Hannes\n"},{"id":"108206","messageId":"alpine.DEB.1.00.0903171117480.6393@intel-tinevez-2-302","threadId":"18341","inReplyTo":"49BF692B.9020002@viscovery.net","subject":"Re: --exec-path not always honored","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-17T10:19:28Z","receivedAt":"2009-03-17T10:19:28Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 17 Mar 2009, Johannes Sixt wrote:\n\n> I noticed this failure if I run git from the build directory:\n> \n> $ ./git --exec-path=. gc\n\nI am not sure if \".\" is what you think it is; I imagine it would be \n$GIT_DIR by the time the PATH variable is adjusted.\n\nCould you try again with\n\n\t$ ./git --exec-path=\"$(pwd)\" gc\n\n?\n\nThanks,\nDscho\n"},{"id":"108210","messageId":"49BF7CAF.6060505@viscovery.net","threadId":"18341","inReplyTo":"alpine.DEB.1.00.0903171117480.6393@intel-tinevez-2-302","subject":"Re: --exec-path not always honored","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-17T10:34:23Z","receivedAt":"2009-03-17T10:34:23Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Schindelin schrieb:\n> On Tue, 17 Mar 2009, Johannes Sixt wrote:\n> \n>> I noticed this failure if I run git from the build directory:\n>>\n>> $ ./git --exec-path=. gc\n> \n> I am not sure if \".\" is what you think it is; I imagine it would be \n> $GIT_DIR by the time the PATH variable is adjusted.\n\nThis would be *very* bogus, wouldn't it?\n\n> Could you try again with\n> \n> \t$ ./git --exec-path=\"$(pwd)\" gc\n> \n> ?\n\nIt fails in the same way:\n\n$ ./git --exec-path=$(pwd) gc\nusage: git pack-objects blah blah...\nerror: failed to run repack\n\n-- Hannes\n"},{"id":"108335","messageId":"7v7i2nmlpt.fsf@gitster.siamese.dyndns.org","threadId":"18341","inReplyTo":"49BF692B.9020002@viscovery.net","subject":"Re: --exec-path not always honored","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-18T05:41:34Z","receivedAt":"2009-03-18T05:41:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> git-gc is a builtin. Should git setenv(\"GIT_EXEC_PATH\") before it runs\n> other git commands?\n\nI think we just never have bothered about such a use case, but you are\nright.  It probably is a good solution, although setenv makes me feel a\nbit nervous for no rational reason.\n"},{"id":"108351","messageId":"49C0A5FD.70004@viscovery.net","threadId":"18341","inReplyTo":"7v7i2nmlpt.fsf@gitster.siamese.dyndns.org","subject":"Re: --exec-path not always honored","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-18T07:42:53Z","receivedAt":"2009-03-18T07:42:53Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Junio C Hamano schrieb:\n> Johannes Sixt <j.sixt@viscovery.net> writes:\n> \n>> git-gc is a builtin. Should git setenv(\"GIT_EXEC_PATH\") before it runs\n>> other git commands?\n> \n> I think we just never have bothered about such a use case, but you are\n> right.  It probably is a good solution, although setenv makes me feel a\n> bit nervous for no rational reason.\n\nThis patch fixes the use case and is IMO the most logical solution.\n\ndiff --git a/exec_cmd.c b/exec_cmd.c\nindex 217c125..408e4e5 100644\n--- a/exec_cmd.c\n+++ b/exec_cmd.c\n@@ -61,6 +61,10 @@ const char *git_extract_argv0_path(const char *argv0)\n void git_set_argv_exec_path(const char *exec_path)\n {\n \targv_exec_path = exec_path;\n+\t/*\n+\t * Propagate this setting to external programs.\n+\t */\n+\tsetenv(EXEC_PATH_ENVIRONMENT, exec_path, 1);\n }\n"}]}