Skip to content

Commit

Permalink
Fix relative built-in paths to be relative to the command invocation
Browse files Browse the repository at this point in the history
$(gitexecdir) (as defined in the Makefile) has gained another path
component, but the relative paths in the MINGW section of the Makefile,
which are interpreted relative to it, do not account for it.

Instead of adding another ../ in front of the path, we change the code that
constructs the absolute paths to do it relative to the command's directory,
which is essentially $(bindir). We do it this way because we will also
allow a relative $(gitexecdir) later.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Sixt authored and Junio C Hamano committed Jul 26, 2008
1 parent e1464ca commit 966c6ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ remove-dashes:
### Installation rules

ifeq ($(firstword $(subst /, ,$(template_dir))),..)
template_instdir = $(gitexecdir)/$(template_dir)
template_instdir = $(bindir)/$(template_dir)
else
template_instdir = $(template_dir)
endif
Expand Down
4 changes: 2 additions & 2 deletions exec_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ static const char *builtin_exec_path(void)

const char *system_path(const char *path)
{
if (!is_absolute_path(path)) {
if (!is_absolute_path(path) && argv0_path) {
struct strbuf d = STRBUF_INIT;
strbuf_addf(&d, "%s/%s", git_exec_path(), path);
strbuf_addf(&d, "%s/%s", argv0_path, path);
path = strbuf_detach(&d, NULL);
}
return path;
Expand Down

0 comments on commit 966c6ed

Please sign in to comment.