<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/exec_cmd.c, branch v1.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v1.6.2</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v1.6.2'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2009-02-20T06:47:39Z</updated>
<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://www.git.shady.money/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://www.git.shady.money/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://www.git.shady.money/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://www.git.shady.money/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://www.git.shady.money/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://www.git.shady.money/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://www.git.shady.money/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://www.git.shady.money/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>
<entry>
<title>Allow add_path() to add non-existent directories to the path</title>
<updated>2008-07-26T00:41:13Z</updated>
<author>
<name>Johannes Sixt</name>
<email>johannes.sixt@telecom.at</email>
</author>
<published>2008-07-21T19:19:55Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=10c4c881c4d2cb0ece0508e7142e189e68445257'/>
<id>urn:sha1:10c4c881c4d2cb0ece0508e7142e189e68445257</id>
<content type='text'>
This function had used make_absolute_path(); but this function dies if
the directory that contains the entry whose relative path was supplied in
the argument does not exist. This is a problem if the argument is, for
example, "../libexec/git-core", and that "../libexec" does not exist.

Since the resolution of symbolic links is not required for elements in
PATH, we can fall back to using make_nonrelative_path(), which simply
prepends $PWD to the path.

We have to move make_nonrelative_path() alongside make_absolute_path() in
abspath.c so that git-shell can be linked. See 5b8e6f85f.

Signed-off-by: Johannes Sixt &lt;johannes.sixt@telecom.at&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Allow the built-in exec path to be relative to the command invocation path</title>
<updated>2008-07-26T00:41:13Z</updated>
<author>
<name>Johannes Sixt</name>
<email>johannes.sixt@telecom.at</email>
</author>
<published>2008-07-23T19:12:18Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=49fa65a7a8185e81c1098815df607042103b0493'/>
<id>urn:sha1:49fa65a7a8185e81c1098815df607042103b0493</id>
<content type='text'>
If GIT_EXEC_PATH (the macro that is defined in the Makefile) is relative,
it is interpreted relative to the command's invocation path, which usually
is $(bindir).

The Makefile rules were written with the assumption that $(gitexecdir) is
an absolute path. We introduce a separate variable that names the
(absolute) installation directory.

Signed-off-by: Johannes Sixt &lt;johannes.sixt@telecom.at&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
