git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* --exec-path not always honored
@ 2009-03-17  9:11 Johannes Sixt
  2009-03-17 10:19 ` Johannes Schindelin
  2009-03-18  5:41 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Johannes Sixt @ 2009-03-17  9:11 UTC (permalink / raw
  To: Git Mailing List

I noticed this failure if I run git from the build directory:

$ ./git --exec-path=. gc
usage: git pack-objects [{ -q | --progress | --all-progress }]
        [--max-pack-size=N] [--local] [--incremental]
        [--window=N] [--window-memory=N] [--depth=N]
        [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]
        [--threads=N] [--non-empty] [--revs [--unpacked | --all]*] [--reflog]
        [--include-tag] [--keep-unreachable | --unpack-unreachable]
        --stdout | base-name < ref-or-object-list
error: failed to run repack

The reason is that the version of pack-objects that I have installed in
$prefix does not know the option --kept-pack-only, which ./git-repack
passes along. It doesn't matter whether I have $prefix in PATH or not.

But on the other hand:

$ ./git --exec-path=. repack -a -d
Counting objects: 104070, done.
Delta compression using 2 threads.
Compressing objects: 100% (26161/26161), done.
Writing objects: 100% (104070/104070), done.
Total 104070 (delta 76376), reused 104070 (delta 76376)

works just fine whereas without --exec-path it fails like git-gc above.

git-gc is a builtin. Should git setenv("GIT_EXEC_PATH") before it runs
other git commands?

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --exec-path not always honored
  2009-03-17  9:11 --exec-path not always honored Johannes Sixt
@ 2009-03-17 10:19 ` Johannes Schindelin
  2009-03-17 10:34   ` Johannes Sixt
  2009-03-18  5:41 ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2009-03-17 10:19 UTC (permalink / raw
  To: Johannes Sixt; +Cc: Git Mailing List

Hi,

On Tue, 17 Mar 2009, Johannes Sixt wrote:

> I noticed this failure if I run git from the build directory:
> 
> $ ./git --exec-path=. gc

I am not sure if "." is what you think it is; I imagine it would be 
$GIT_DIR by the time the PATH variable is adjusted.

Could you try again with

	$ ./git --exec-path="$(pwd)" gc

?

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --exec-path not always honored
  2009-03-17 10:19 ` Johannes Schindelin
@ 2009-03-17 10:34   ` Johannes Sixt
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Sixt @ 2009-03-17 10:34 UTC (permalink / raw
  To: Johannes Schindelin; +Cc: Git Mailing List

Johannes Schindelin schrieb:
> On Tue, 17 Mar 2009, Johannes Sixt wrote:
> 
>> I noticed this failure if I run git from the build directory:
>>
>> $ ./git --exec-path=. gc
> 
> I am not sure if "." is what you think it is; I imagine it would be 
> $GIT_DIR by the time the PATH variable is adjusted.

This would be *very* bogus, wouldn't it?

> Could you try again with
> 
> 	$ ./git --exec-path="$(pwd)" gc
> 
> ?

It fails in the same way:

$ ./git --exec-path=$(pwd) gc
usage: git pack-objects blah blah...
error: failed to run repack

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --exec-path not always honored
  2009-03-17  9:11 --exec-path not always honored Johannes Sixt
  2009-03-17 10:19 ` Johannes Schindelin
@ 2009-03-18  5:41 ` Junio C Hamano
  2009-03-18  7:42   ` Johannes Sixt
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2009-03-18  5:41 UTC (permalink / raw
  To: Johannes Sixt; +Cc: Git Mailing List

Johannes Sixt <j.sixt@viscovery.net> writes:

> git-gc is a builtin. Should git setenv("GIT_EXEC_PATH") before it runs
> other git commands?

I think we just never have bothered about such a use case, but you are
right.  It probably is a good solution, although setenv makes me feel a
bit nervous for no rational reason.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --exec-path not always honored
  2009-03-18  5:41 ` Junio C Hamano
@ 2009-03-18  7:42   ` Johannes Sixt
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Sixt @ 2009-03-18  7:42 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Git Mailing List

Junio C Hamano schrieb:
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
>> git-gc is a builtin. Should git setenv("GIT_EXEC_PATH") before it runs
>> other git commands?
> 
> I think we just never have bothered about such a use case, but you are
> right.  It probably is a good solution, although setenv makes me feel a
> bit nervous for no rational reason.

This patch fixes the use case and is IMO the most logical solution.

diff --git a/exec_cmd.c b/exec_cmd.c
index 217c125..408e4e5 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -61,6 +61,10 @@ const char *git_extract_argv0_path(const char *argv0)
 void git_set_argv_exec_path(const char *exec_path)
 {
 	argv_exec_path = exec_path;
+	/*
+	 * Propagate this setting to external programs.
+	 */
+	setenv(EXEC_PATH_ENVIRONMENT, exec_path, 1);
 }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-18  7:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-17  9:11 --exec-path not always honored Johannes Sixt
2009-03-17 10:19 ` Johannes Schindelin
2009-03-17 10:34   ` Johannes Sixt
2009-03-18  5:41 ` Junio C Hamano
2009-03-18  7:42   ` Johannes Sixt

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).