<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/exec_cmd.c, branch v1.6.4.5</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.6.4.5</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.6.4.5'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2009-03-26T07:27:03Z</updated>
<entry>
<title>Merge branch 'js/maint-1.6.0-exec-path-env'</title>
<updated>2009-03-26T07:27:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-03-26T07:27:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=b2aa958dc29eb836a831138f6d84ad7cfadf4355'/>
<id>urn:sha1:b2aa958dc29eb836a831138f6d84ad7cfadf4355</id>
<content type='text'>
* js/maint-1.6.0-exec-path-env:
  Propagate --exec-path setting to external commands via GIT_EXEC_PATH
</content>
</entry>
<entry>
<title>Propagate --exec-path setting to external commands via GIT_EXEC_PATH</title>
<updated>2009-03-22T04:45:14Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2009-03-21T22:21:18Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=c90d565a46a664663467557d381417a3153fe26e'/>
<id>urn:sha1:c90d565a46a664663467557d381417a3153fe26e</id>
<content type='text'>
Let PATH0=$PATH that was set before the invocation.
Let /foo be a build directory.
Let /pfx be the installation prefix.
Let pfxexecpath=/pfx/libexec/git-core.

The following is going on when 'git --exec-path=/foo gc' is invoked:

1. git sets PATH=/foo:$PATH0 using the path from --exec-path

2. gc execs 'git repack' (note: no dash).

3. Since there is a git in /foo (it's a build directory), /foo/git is
   taken.

4. No explicit exec-path is set this time, hence, this secondary git sets
   PATH=$pfxexecpath:/foo:$PATH

5. Since 'repack' is not a built-in, execv_dashed_external execs
   'git-repack' (note: dash).

6. There is a $pfxexecpath/git-repack, and it is taken.

7. This git-repack runs 'git pack-objects' (note: no dash).

8. There is no git in $pfxexecpath, but there is one in /foo. Hence,
   /foo/git is run.

9. pack-objects is a builtin, hence, in effect /foo/git-pack-objects
   is run.

As you can see, the way in which we previously set the PATH allowed to
mix gits of different vintage.  By setting GIT_EXEC_PATH when --exec-path
was given on the command line, we reduce the confusion.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>system_path(): simplify using strip_path_suffix(), and add suffix "git"</title>
<updated>2009-02-20T06:47:39Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2009-02-19T19:10:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=024aa7d8d5114f76e616a0ed8ddcf3b463ff2c14'/>
<id>urn:sha1:024aa7d8d5114f76e616a0ed8ddcf3b463ff2c14</id>
<content type='text'>
At least for the author of this patch, the logic in system_path() was
too hard to understand.  Using the function strip_path_suffix() documents
the idea of the code better.

The real change is to add the suffix "git", so that a runtime prefix will
be computed correctly even when the executable was called in /git/ as is
the case in msysGit (Windows insists to search the current directory
before the PATH when looking for an executable).

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Compute prefix at runtime if RUNTIME_PREFIX is set</title>
<updated>2009-01-26T08:26:05Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2009-01-18T12:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=35fb0e8633217f602360a9987af51c4b960e7850'/>
<id>urn:sha1:35fb0e8633217f602360a9987af51c4b960e7850</id>
<content type='text'>
This commit adds support for relocatable binaries (called
RUNTIME_PREFIX).  Such binaries can be moved together with the
system configuration files to a different directory, as long as the
relative paths from the binary to the configuration files is
preserved.  This functionality is essential on Windows where we
deliver git binaries with an installer that allows to freely choose
the installation location.

If RUNTIME_PREFIX is unset we use the static prefix.  This will be
the default on Unix.  Thus, the behavior on Unix will remain
identical to the old implementation, which used to add the prefix
in the Makefile.

If RUNTIME_PREFIX is set the prefix is computed from the location
of the executable.  In this case, system_path() tries to strip
known directories that executables can be located in from the path
of the executable.  If the path is successfully stripped it is used
as the prefix.  For example, if the executable is
"/msysgit/bin/git" and BINDIR is "bin", then the prefix computed is
"/msysgit".

If the runtime prefix computation fails, we fall back to the static
prefix specified in the makefile.  This can be the case if the
executable is not installed at a known location.  Note that our
test system sets GIT_CONFIG_NOSYSTEM to tell git to ignore global
configuration files during testing.  Hence testing does not trigger
the fall back.

Note that RUNTIME_PREFIX only works on Windows, though adding
support on Unix should not be too hard.  The implementation
requires argv0_path to be set to an absolute path.  argv0_path must
point to the directory of the executable.  We use assert() to
verify this in debug builds.  On Windows, the wrapper for main()
(see compat/mingw.h) guarantees that argv0_path is correctly
initialized.  On Unix, further work is required before
RUNTIME_PREFIX can be enabled.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Modify setup_path() to only add git_exec_path() to PATH</title>
<updated>2009-01-26T08:26:05Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2009-01-18T12:00:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=8e3462837b0ace04357503a3f58802cc2231df29'/>
<id>urn:sha1:8e3462837b0ace04357503a3f58802cc2231df29</id>
<content type='text'>
Searching git programs only in the highest priority location is
sufficient.  It does not make sense that some of the required
programs are located at the highest priority location but other
programs are picked up from a lower priority exec-path.  If
exec-path is overridden a complete set of commands should be
provided, otherwise several different versions could get mixed,
which is likely to cause confusion.

If a user explicitly overrides the default location (by --exec-path
or GIT_EXEC_PATH), we now expect that all the required programs are
found there.  Instead of adding the directories "argv_exec_path",
"getenv(EXEC_PATH_ENVIRONMENT)", and "system_path(GIT_EXEC_PATH)"
to PATH, we now rely on git_exec_path(), which implements the same
order, but only returns the highest priority location to search for
executables.

Accessing only the location with highest priority is also required
for testing executables built with RUNTIME_PREFIX.  The call to
system_path() should be avoided if RUNTIME_PREFIX is set and the
executable is not installed at its final destination.  Because we
test before installing, we want to avoid calling system_path()
during tests.  The modifications in this commit avoid calling
system_path(GIT_EXEC_PATH) if a higher-priority location is
provided, which is the case when running the tests.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git_extract_argv0_path(): Move check for valid argv0 from caller to callee</title>
<updated>2009-01-26T08:26:05Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2009-01-18T12:00:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=2cd72b0b290e40fb4d6a925ce26603503f01aa09'/>
<id>urn:sha1:2cd72b0b290e40fb4d6a925ce26603503f01aa09</id>
<content type='text'>
This simplifies the calling code.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Refactor git_set_argv0_path() to git_extract_argv0_path()</title>
<updated>2009-01-26T08:26:05Z</updated>
<author>
<name>Steve Haslam</name>
<email>shaslam@lastminute.com</email>
</author>
<published>2009-01-18T12:00:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=4dd47c3b867f51211d0dc4474dab0fee5ca614da'/>
<id>urn:sha1:4dd47c3b867f51211d0dc4474dab0fee5ca614da</id>
<content type='text'>
This commit moves the code that computes the dirname of argv[0]
from git.c's main() to git_set_argv0_path() and renames the function
to git_extract_argv0_path().  This makes the code in git.c's main
less cluttered, and we can use the dirname computation from other
main() functions too.

[ spr:
 - split Steve's original commit and wrote new commit message.
 - Integrated Johannes Schindelin's
   cca1704897e7fdb182f68d4c48a437c5d7bc5203 while rebasing onto master.
]

Signed-off-by: Steve Haslam &lt;shaslam@lastminute.com&gt;
Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Move computation of absolute paths from Makefile to runtime (in preparation for RUNTIME_PREFIX)</title>
<updated>2009-01-26T08:26:05Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2009-01-18T12:00:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=026fa0d5ad9538ca76838070861531c037d7b9ba'/>
<id>urn:sha1:026fa0d5ad9538ca76838070861531c037d7b9ba</id>
<content type='text'>
This commit prepares the Makefile for relocatable binaries (called
RUNTIME_PREFIX).  Such binaries will be able to be moved together
with the system configuration files to a different directory,
requiring to compute the prefix at runtime.

In a first step, we make all paths relative in the Makefile and
teach system_path() to add the prefix instead.  We used to compute
absolute paths in the Makefile and passed them to C as defines.  We
now pass relative paths to C and call system_path() to add the
prefix at runtime.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Replace calls to strbuf_init(&amp;foo, 0) with STRBUF_INIT initializer</title>
<updated>2008-10-12T19:36:19Z</updated>
<author>
<name>Brandon Casey</name>
<email>casey@nrlssc.navy.mil</email>
</author>
<published>2008-10-09T19:12:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=f285a2d7ed6548666989406de8f0e7233eb84368'/>
<id>urn:sha1:f285a2d7ed6548666989406de8f0e7233eb84368</id>
<content type='text'>
Many call sites use strbuf_init(&amp;foo, 0) to initialize local
strbuf variable "foo" which has not been accessed since its
declaration. These can be replaced with a static initialization
using the STRBUF_INIT macro which is just as readable, saves a
function call, and takes up fewer lines.

Signed-off-by: Brandon Casey &lt;casey@nrlssc.navy.mil&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Refactor, adding prepare_git_cmd(const char **argv)</title>
<updated>2008-07-29T06:02:11Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2008-07-28T05:50:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=4933e5ebdefdb88841275132ef358e6649963751'/>
<id>urn:sha1:4933e5ebdefdb88841275132ef358e6649963751</id>
<content type='text'>
prepare_git_cmd(const char **argv) adds a first entry "git" to
the array argv.  The new array is allocated on the heap.  It's
the caller's responsibility to release it with free().  The code
was already present in execv_git_cmd() but could not be used from
outside.  Now it can also be called for preparing the command list
in the MinGW codepath in run-command.c.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
