{"thread":{"id":"14575","subject":"[PATCH 2/9] Makefile: Normalize $(bindir) and $(gitexecdir) before comparing","startedAt":"2008-07-21T19:19:49Z","lastAt":"2008-07-28T23:13:00Z","messageCount":32,"participants":["Johannes Sixt","Johannes Schindelin","Junio C Hamano","Steffen Prohaska","A Large Angry SCM"],"isPatch":true,"patchVersion":1,"patchTotal":9},"messages":[{"id":"84224","messageId":"1216667998-8879-1-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":null,"subject":"[PATCH 0/9] Make gitexecdir relative to $(bindir) on Windows","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:49Z","receivedAt":"2008-07-21T19:19:49Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"This is a revival of the series of a week or so ago.\n\nI found a workaround for the problem that made me abondon the effort.\nThe problem was that argv[0] does not have a path in certain cases.\nThe workaround is in 8/9, namely to redefine main() and replace\nargv[0] by the value of _pgmptr that the C runtime on Windows provides\nand that always has a full path.\n\nSteffen has suggested not to the path discovery for 'git-*' programs.\nNo change is necessary to do that because programs with a 'git-' prefix\nalready take the path via handle_internal_command() early.\n\n9/9 actually is off-topic, but it depends on 2/9 because it replaces\nthe instance of git-shell in the ./check_bindir line by git-add. If\nyou think it's worthwhile, you could squash this hunk into 2/9.\n\nI'll follow-up with 10/9, which is git-gui specific.\n\nJohannes Sixt (9):\n  Makefile: Do not install a copy of 'git' in $(gitexecdir)\n  Makefile: Normalize $(bindir) and $(gitexecdir) before comparing\n  Record the command invocation path early\n  Fix relative built-in paths to be relative to the command invocation\n  Allow the built-in exec path to be relative to the command invocation\n    path\n  Allow add_path() to add non-existent directories to the path\n  Windows: Make $(gitexecdir) relative\n  Windows: Make sure argv[0] has a path\n  Windows: Do not compile git-shell\n\n Makefile       |   38 ++++++++++++++++++++++++--------------\n abspath.c      |   36 ++++++++++++++++++++++++++++++++++++\n compat/mingw.h |   12 ++++++++++++\n exec_cmd.c     |   54 +++++++++++++-----------------------------------------\n exec_cmd.h     |    3 ++-\n git.c          |    5 ++---\n path.c         |   36 ------------------------------------\n receive-pack.c |    2 +-\n shell.c        |    4 ++--\n upload-pack.c  |    2 +-\n 10 files changed, 93 insertions(+), 99 deletions(-)\n"},{"id":"84227","messageId":"1216667998-8879-2-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-1-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:50Z","receivedAt":"2008-07-21T19:19:50Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"There is already a copy in $(bindir). A subsequent patch will enable git\nto derive the exec-path from its invocation path. If git is invoked\nrecursively, the first invocation puts the exec-path into PATH, so that\nthe recursive invocation would find the instance in the exec-path. This\nsecond instance would again try to derive an exec-path from its invocation\npath, but would base its result on the wrong \"bindir\".\n\nWe do install the copy of git first, but remove it later, so that we can\nuse it as the source of the hardlinks for the builtins.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 551bde9..cbab4f9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1335,6 +1335,7 @@ endif\n \t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \\\n \tfi\n \t$(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)\n+\t$(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'\n ifneq (,$X)\n \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n endif\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84221","messageId":"1216667998-8879-3-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-2-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 2/9] Makefile: Normalize $(bindir) and $(gitexecdir) before comparing","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:51Z","receivedAt":"2008-07-21T19:19:51Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"The install target needs to check whether the user has opted to make\n$(gitexecdir) equal to $(bindir). It did so by a straight string\ncomparison. Since we are going to allow a relative $(gitexecdir), we have\nto normalize paths before comparison, which we do with $(cd there && pwd).\n\nThe normalized paths are stored in shell variables. These we can now\nreuse in the subsequent install statements, which conveniently shortens\nthe lines a bit.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile |   20 ++++++++++----------\n 1 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex cbab4f9..226dd03 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1327,19 +1327,19 @@ ifndef NO_TCLTK\n \t$(MAKE) -C gitk-git install\n \t$(MAKE) -C git-gui install\n endif\n-\tif test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \\\n-\tthen \\\n-\t\tln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \\\n-\t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \\\n-\t\tcp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \\\n-\t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \\\n-\tfi\n-\t$(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)\n-\t$(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'\n ifneq (,$X)\n \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n endif\n-\t./check_bindir 'z$(bindir_SQ)' 'z$(gitexecdir_SQ)' '$(DESTDIR_SQ)$(bindir_SQ)/git-shell$X'\n+\tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n+\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexecdir_SQ)' && pwd) && \\\n+\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n+\tthen \\\n+\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n+\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n+\tfi && \\\n+\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n+\t$(RM) \"$$execdir/git$X\" && \\\n+\t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-shell$X\"\n \n install-doc:\n \t$(MAKE) -C Documentation install\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84229","messageId":"1216667998-8879-4-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-3-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 3/9] Record the command invocation path early","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:52Z","receivedAt":"2008-07-21T19:19:52Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"We will need the command invocation path in system_path(). This path was\npassed to setup_path(), but  system_path() can be called earlier, for\nexample via:\n\n    main\n      commit_pager_choice\n        setup_pager\n          git_config\n            git_etc_gitconfig\n              system_path\n\nTherefore, we introduce git_set_argv0_path() and call it as soon as\npossible.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n exec_cmd.c     |   10 ++++++++--\n exec_cmd.h     |    3 ++-\n git.c          |    5 ++---\n receive-pack.c |    2 +-\n shell.c        |    4 ++--\n upload-pack.c  |    2 +-\n 6 files changed, 16 insertions(+), 10 deletions(-)\n\ndiff --git a/exec_cmd.c b/exec_cmd.c\nindex 8899e31..dedb01d 100644\n--- a/exec_cmd.c\n+++ b/exec_cmd.c\n@@ -5,6 +5,7 @@\n \n extern char **environ;\n static const char *argv_exec_path;\n+static const char *argv0_path;\n \n static const char *builtin_exec_path(void)\n {\n@@ -50,6 +51,11 @@ const char *system_path(const char *path)\n \treturn path;\n }\n \n+void git_set_argv0_path(const char *path)\n+{\n+\targv0_path = path;\n+}\n+\n void git_set_argv_exec_path(const char *exec_path)\n {\n \targv_exec_path = exec_path;\n@@ -84,7 +90,7 @@ static void add_path(struct strbuf *out, const char *path)\n \t}\n }\n \n-void setup_path(const char *cmd_path)\n+void setup_path(void)\n {\n \tconst char *old_path = getenv(\"PATH\");\n \tstruct strbuf new_path;\n@@ -94,7 +100,7 @@ void setup_path(const char *cmd_path)\n \tadd_path(&new_path, argv_exec_path);\n \tadd_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));\n \tadd_path(&new_path, builtin_exec_path());\n-\tadd_path(&new_path, cmd_path);\n+\tadd_path(&new_path, argv0_path);\n \n \tif (old_path)\n \t\tstrbuf_addstr(&new_path, old_path);\ndiff --git a/exec_cmd.h b/exec_cmd.h\nindex 7eb94e5..0c46cd5 100644\n--- a/exec_cmd.h\n+++ b/exec_cmd.h\n@@ -2,8 +2,9 @@\n #define GIT_EXEC_CMD_H\n \n extern void git_set_argv_exec_path(const char *exec_path);\n+extern void git_set_argv0_path(const char *path);\n extern const char* git_exec_path(void);\n-extern void setup_path(const char *);\n+extern void setup_path(void);\n extern int execv_git_cmd(const char **argv); /* NULL terminated */\n extern int execl_git_cmd(const char *cmd, ...);\n extern const char *system_path(const char *path);\ndiff --git a/git.c b/git.c\nindex 74ea0e6..9c0dd88 100644\n--- a/git.c\n+++ b/git.c\n@@ -418,7 +418,6 @@ int main(int argc, const char **argv)\n {\n \tconst char *cmd = argv[0] && *argv[0] ? argv[0] : \"git-help\";\n \tchar *slash = (char *)cmd + strlen(cmd);\n-\tconst char *cmd_path = NULL;\n \tint done_alias = 0;\n \n \t/*\n@@ -431,7 +430,7 @@ int main(int argc, const char **argv)\n \twhile (cmd <= slash && !is_dir_sep(*slash));\n \tif (cmd <= slash) {\n \t\t*slash++ = 0;\n-\t\tcmd_path = cmd;\n+\t\tgit_set_argv0_path(cmd);\n \t\tcmd = slash;\n \t}\n \n@@ -475,7 +474,7 @@ int main(int argc, const char **argv)\n \t * environment, and the $(gitexecdir) from the Makefile at build\n \t * time.\n \t */\n-\tsetup_path(cmd_path);\n+\tsetup_path();\n \n \twhile (1) {\n \t\t/* See if it's an internal command */\ndiff --git a/receive-pack.c b/receive-pack.c\nindex fa653b4..d44c19e 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -482,7 +482,7 @@ int main(int argc, char **argv)\n \tif (!dir)\n \t\tusage(receive_pack_usage);\n \n-\tsetup_path(NULL);\n+\tsetup_path();\n \n \tif (!enter_repo(dir, 0))\n \t\tdie(\"'%s': unable to chdir or not a git archive\", dir);\ndiff --git a/shell.c b/shell.c\nindex 91ca7de..6a48de0 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -15,7 +15,7 @@ static int do_generic_cmd(const char *me, char *arg)\n {\n \tconst char *my_argv[4];\n \n-\tsetup_path(NULL);\n+\tsetup_path();\n \tif (!arg || !(arg = sq_dequote(arg)))\n \t\tdie(\"bad argument\");\n \tif (prefixcmp(me, \"git-\"))\n@@ -37,7 +37,7 @@ static int do_cvs_cmd(const char *me, char *arg)\n \tif (!arg || strcmp(arg, \"server\"))\n \t\tdie(\"git-cvsserver only handles server: %s\", arg);\n \n-\tsetup_path(NULL);\n+\tsetup_path();\n \treturn execv_git_cmd(cvsserver_argv);\n }\n \ndiff --git a/upload-pack.c b/upload-pack.c\nindex 9f82941..c911e70 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -638,7 +638,7 @@ int main(int argc, char **argv)\n \tif (i != argc-1)\n \t\tusage(upload_pack_usage);\n \n-\tsetup_path(NULL);\n+\tsetup_path();\n \n \tdir = argv[i];\n \n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84222","messageId":"1216667998-8879-5-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-4-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 4/9] Fix relative built-in paths to be relative to the command invocation","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:53Z","receivedAt":"2008-07-21T19:19:53Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"$(gitexecdir) (as defined in the Makefile) has gained another path\ncomponent, but the relative paths in the MINGW section of the Makefile,\nwhich are interpreted relative to it, do not account for it.\n\nInstead of adding another ../ in front of the path, we change the code that\nconstructs the absolute paths to do it relative to the command's directory,\nwhich is essentially $(bindir). We do it this way because we will also\nallow a relative $(gitexecdir) later.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile   |    2 +-\n exec_cmd.c |    4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 226dd03..23f2185 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1310,7 +1310,7 @@ remove-dashes:\n ### Installation rules\n \n ifeq ($(firstword $(subst /, ,$(template_dir))),..)\n-template_instdir = $(gitexecdir)/$(template_dir)\n+template_instdir = $(bindir)/$(template_dir)\n else\n template_instdir = $(template_dir)\n endif\ndiff --git a/exec_cmd.c b/exec_cmd.c\nindex dedb01d..45f92eb 100644\n--- a/exec_cmd.c\n+++ b/exec_cmd.c\n@@ -43,9 +43,9 @@ static const char *builtin_exec_path(void)\n \n const char *system_path(const char *path)\n {\n-\tif (!is_absolute_path(path)) {\n+\tif (!is_absolute_path(path) && argv0_path) {\n \t\tstruct strbuf d = STRBUF_INIT;\n-\t\tstrbuf_addf(&d, \"%s/%s\", git_exec_path(), path);\n+\t\tstrbuf_addf(&d, \"%s/%s\", argv0_path, path);\n \t\tpath = strbuf_detach(&d, NULL);\n \t}\n \treturn path;\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84228","messageId":"1216667998-8879-6-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-5-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 5/9] Allow the built-in exec path to be relative to the command invocation path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:54Z","receivedAt":"2008-07-21T19:19:54Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"If $(gitexecdir) is relative, it is interpreted relative to the command's\ninvocation path, which usually is $(bindir).\n\nThe Makefile rules were written with the assumption that $(gitexecdir) is\nan absolute path. We introduce a separate variable that names the\n(absolute) installation directory.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile   |   16 ++++++++++++----\n exec_cmd.c |   38 ++------------------------------------\n 2 files changed, 14 insertions(+), 40 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 23f2185..908c1cb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1316,10 +1316,18 @@ template_instdir = $(template_dir)\n endif\n export template_instdir\n \n+ifeq ($(firstword $(subst /, ,$(gitexecdir))),..)\n+gitexec_instdir = $(bindir)/$(gitexecdir)\n+else\n+gitexec_instdir = $(gitexecdir)\n+endif\n+gitexec_instdir_SQ = $(subst ','\\'',$(gitexec_instdir))\n+export gitexec_instdir\n+\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n-\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'\n-\t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n+\t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n@@ -1328,10 +1336,10 @@ ifndef NO_TCLTK\n \t$(MAKE) -C git-gui install\n endif\n ifneq (,$X)\n-\t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n+\t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)\n endif\n \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n-\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexecdir_SQ)' && pwd) && \\\n+\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n \tthen \\\n \t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\ndiff --git a/exec_cmd.c b/exec_cmd.c\nindex 45f92eb..c236034 100644\n--- a/exec_cmd.c\n+++ b/exec_cmd.c\n@@ -7,40 +7,6 @@ extern char **environ;\n static const char *argv_exec_path;\n static const char *argv0_path;\n \n-static const char *builtin_exec_path(void)\n-{\n-#ifndef __MINGW32__\n-\treturn GIT_EXEC_PATH;\n-#else\n-\tint len;\n-\tchar *p, *q, *sl;\n-\tstatic char *ep;\n-\tif (ep)\n-\t\treturn ep;\n-\n-\tlen = strlen(_pgmptr);\n-\tif (len < 2)\n-\t\treturn ep = \".\";\n-\n-\tp = ep = xmalloc(len+1);\n-\tq = _pgmptr;\n-\tsl = NULL;\n-\t/* copy program name, turn '\\\\' into '/', skip last part */\n-\twhile ((*p = *q)) {\n-\t\tif (*q == '\\\\' || *q == '/') {\n-\t\t\t*p = '/';\n-\t\t\tsl = p;\n-\t\t}\n-\t\tp++, q++;\n-\t}\n-\tif (sl)\n-\t\t*sl = '\\0';\n-\telse\n-\t\tep[0] = '.', ep[1] = '\\0';\n-\treturn ep;\n-#endif\n-}\n-\n const char *system_path(const char *path)\n {\n \tif (!is_absolute_path(path) && argv0_path) {\n@@ -75,7 +41,7 @@ const char *git_exec_path(void)\n \t\treturn env;\n \t}\n \n-\treturn builtin_exec_path();\n+\treturn system_path(GIT_EXEC_PATH);\n }\n \n static void add_path(struct strbuf *out, const char *path)\n@@ -99,7 +65,7 @@ void setup_path(void)\n \n \tadd_path(&new_path, argv_exec_path);\n \tadd_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));\n-\tadd_path(&new_path, builtin_exec_path());\n+\tadd_path(&new_path, system_path(GIT_EXEC_PATH));\n \tadd_path(&new_path, argv0_path);\n \n \tif (old_path)\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84226","messageId":"1216667998-8879-7-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-6-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 6/9] Allow add_path() to add non-existent directories to the path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:55Z","receivedAt":"2008-07-21T19:19:55Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"This function had used make_absolute_path(); but this function dies if\nthe directory that contains the entry whose relative path was supplied in\nthe argument does not exist. This is a problem if the argument is, for\nexample, \"../libexec/git-core\", and that \"../libexec\" does not exist.\n\nSince the resolution of symbolic links is not required for elements in\nPATH, we can fall back to using make_nonrelative_path(), which simply\nprepends $PWD to the path.\n\nWe have to move make_nonrelative_path() alongside make_absolute_path() in\nabspath.c so that git-shell can be linked. See 5b8e6f85f.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n abspath.c  |   36 ++++++++++++++++++++++++++++++++++++\n exec_cmd.c |    2 +-\n path.c     |   36 ------------------------------------\n 3 files changed, 37 insertions(+), 37 deletions(-)\n\ndiff --git a/abspath.c b/abspath.c\nindex 4f95a95..0d56124 100644\n--- a/abspath.c\n+++ b/abspath.c\n@@ -66,3 +66,39 @@ const char *make_absolute_path(const char *path)\n \n \treturn buf;\n }\n+\n+static const char *get_pwd_cwd(void)\n+{\n+\tstatic char cwd[PATH_MAX + 1];\n+\tchar *pwd;\n+\tstruct stat cwd_stat, pwd_stat;\n+\tif (getcwd(cwd, PATH_MAX) == NULL)\n+\t\treturn NULL;\n+\tpwd = getenv(\"PWD\");\n+\tif (pwd && strcmp(pwd, cwd)) {\n+\t\tstat(cwd, &cwd_stat);\n+\t\tif (!stat(pwd, &pwd_stat) &&\n+\t\t    pwd_stat.st_dev == cwd_stat.st_dev &&\n+\t\t    pwd_stat.st_ino == cwd_stat.st_ino) {\n+\t\t\tstrlcpy(cwd, pwd, PATH_MAX);\n+\t\t}\n+\t}\n+\treturn cwd;\n+}\n+\n+const char *make_nonrelative_path(const char *path)\n+{\n+\tstatic char buf[PATH_MAX + 1];\n+\n+\tif (is_absolute_path(path)) {\n+\t\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n+\t\t\tdie(\"Too long path: %.*s\", 60, path);\n+\t} else {\n+\t\tconst char *cwd = get_pwd_cwd();\n+\t\tif (!cwd)\n+\t\t\tdie(\"Cannot determine the current working directory\");\n+\t\tif (snprintf(buf, PATH_MAX, \"%s/%s\", cwd, path) >= PATH_MAX)\n+\t\t\tdie(\"Too long path: %.*s\", 60, path);\n+\t}\n+\treturn buf;\n+}\ndiff --git a/exec_cmd.c b/exec_cmd.c\nindex c236034..0ed768d 100644\n--- a/exec_cmd.c\n+++ b/exec_cmd.c\n@@ -50,7 +50,7 @@ static void add_path(struct strbuf *out, const char *path)\n \t\tif (is_absolute_path(path))\n \t\t\tstrbuf_addstr(out, path);\n \t\telse\n-\t\t\tstrbuf_addstr(out, make_absolute_path(path));\n+\t\t\tstrbuf_addstr(out, make_nonrelative_path(path));\n \n \t\tstrbuf_addch(out, PATH_SEP);\n \t}\ndiff --git a/path.c b/path.c\nindex 504eae0..9df447b 100644\n--- a/path.c\n+++ b/path.c\n@@ -291,42 +291,6 @@ int adjust_shared_perm(const char *path)\n \treturn 0;\n }\n \n-static const char *get_pwd_cwd(void)\n-{\n-\tstatic char cwd[PATH_MAX + 1];\n-\tchar *pwd;\n-\tstruct stat cwd_stat, pwd_stat;\n-\tif (getcwd(cwd, PATH_MAX) == NULL)\n-\t\treturn NULL;\n-\tpwd = getenv(\"PWD\");\n-\tif (pwd && strcmp(pwd, cwd)) {\n-\t\tstat(cwd, &cwd_stat);\n-\t\tif (!stat(pwd, &pwd_stat) &&\n-\t\t    pwd_stat.st_dev == cwd_stat.st_dev &&\n-\t\t    pwd_stat.st_ino == cwd_stat.st_ino) {\n-\t\t\tstrlcpy(cwd, pwd, PATH_MAX);\n-\t\t}\n-\t}\n-\treturn cwd;\n-}\n-\n-const char *make_nonrelative_path(const char *path)\n-{\n-\tstatic char buf[PATH_MAX + 1];\n-\n-\tif (is_absolute_path(path)) {\n-\t\tif (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)\n-\t\t\tdie (\"Too long path: %.*s\", 60, path);\n-\t} else {\n-\t\tconst char *cwd = get_pwd_cwd();\n-\t\tif (!cwd)\n-\t\t\tdie(\"Cannot determine the current working directory\");\n-\t\tif (snprintf(buf, PATH_MAX, \"%s/%s\", cwd, path) >= PATH_MAX)\n-\t\t\tdie (\"Too long path: %.*s\", 60, path);\n-\t}\n-\treturn buf;\n-}\n-\n const char *make_relative_path(const char *abs, const char *base)\n {\n \tstatic char buf[PATH_MAX + 1];\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84225","messageId":"1216667998-8879-8-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-7-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 7/9] Windows: Make $(gitexecdir) relative","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:56Z","receivedAt":"2008-07-21T19:19:56Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 908c1cb..1bfffff 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -745,6 +745,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tCOMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o\n \tEXTLIBS += -lws2_32\n \tX = .exe\n+\tgitexecdir = ../libexec/git-core\n \ttemplate_dir = ../share/git-core/templates/\n \tETC_GITCONFIG = ../etc/gitconfig\n endif\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84223","messageId":"1216667998-8879-9-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-8-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 8/9] Windows: Make sure argv[0] has a path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:57Z","receivedAt":"2008-07-21T19:19:57Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Since the exec-path on Windows is derived from the program invocation path,\nwe must ensure that argv[0] always has a path. Unfortunately, if a program\nis invoked from CMD, argv[0] has no path. But on the other hand, the\nC runtime offers a global variable, _pgmptr, that always has the full path\nto the program. We hook into main() with a preprocessor macro, where we\nreplace argv[0].\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n compat/mingw.h |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 8ffec51..290a9e6 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -223,3 +223,15 @@ void mingw_open_html(const char *path);\n char **copy_environ(void);\n void free_environ(char **env);\n char **env_setenv(char **env, const char *name);\n+\n+/*\n+ * A replacement of main() that ensures that argv[0] has a path\n+ */\n+\n+#define main(c,v) main(int argc, const char **argv) \\\n+{ \\\n+\tstatic int mingw_main(); \\\n+\targv[0] = xstrdup(_pgmptr); \\\n+\treturn mingw_main(argc, argv); \\\n+} \\\n+static int mingw_main(c,v)\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84230","messageId":"1216667998-8879-10-git-send-email-johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-9-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 9/9] Windows: Do not compile git-shell","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:19:58Z","receivedAt":"2008-07-21T19:19:58Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 1bfffff..f8dd7e6 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -283,7 +283,6 @@ PROGRAMS += git-pack-redundant$X\n PROGRAMS += git-patch-id$X\n PROGRAMS += git-receive-pack$X\n PROGRAMS += git-send-pack$X\n-PROGRAMS += git-shell$X\n PROGRAMS += git-show-index$X\n PROGRAMS += git-unpack-file$X\n PROGRAMS += git-update-server-info$X\n@@ -812,6 +811,7 @@ EXTLIBS += -lz\n ifndef NO_POSIX_ONLY_PROGRAMS\n \tPROGRAMS += git-daemon$X\n \tPROGRAMS += git-imap-send$X\n+\tPROGRAMS += git-shell$X\n endif\n ifndef NO_OPENSSL\n \tOPENSSL_LIBSSL = -lssl\n@@ -1348,7 +1348,7 @@ endif\n \tfi && \\\n \t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n \t$(RM) \"$$execdir/git$X\" && \\\n-\t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-shell$X\"\n+\t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n install-doc:\n \t$(MAKE) -C Documentation install\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84231","messageId":"200807212126.12212.johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"1216667998-8879-10-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH 10/9] git-gui: git.git now uses $(gitexec_instdir) to point to the exec-path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-21T19:26:12Z","receivedAt":"2008-07-21T19:26:12Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"In git.git the Makefile variable $(gitexecdir) can be relative. It now\nexports the actual install location in $(gitexec_instdir).\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Makefile |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b19fb2d..c8660fb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -30,8 +30,12 @@ ifndef SHELL_PATH\n endif\n \n ifndef gitexecdir\n+ifdef gitexec_instdir\n+\tgitexecdir := $(gitexec_instdir)\n+else\n \tgitexecdir := $(shell git --exec-path)\n endif\n+endif\n \n ifndef sharedir\n \tsharedir := $(dir $(gitexecdir))share\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84254","messageId":"alpine.DEB.1.00.0807220140170.3407@eeepc-johanness","threadId":"14575","inReplyTo":"1216667998-8879-1-git-send-email-johannes.sixt@telecom.at","subject":"Re: [PATCH 0/9] Make gitexecdir relative to $(bindir) on Windows","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-21T23:45:47Z","receivedAt":"2008-07-21T23:45:47Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 21 Jul 2008, Johannes Sixt wrote:\n\n> The problem was that argv[0] does not have a path in certain cases.\n\nNote that the same holds true for Linux when calling a program that is in \nthe PATH:\n\n-- snip --\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n        printf(\"%s\\n\", argv[0]);\n        return 0;\n}\n-- snap --\n\ncompiled and put into the PATH will output just what the user said, not \nthe full path.\n\nI imagine that the proper solution would be to rip out lookup_prog() and \nuse it for non-Windows Git, too.  Unless you want to limit the usefulness \nof your patch series to Windows, that is.\n\nIn which case you could use lookup_prog() after unstatifying it.\n\nCiao,\nDscho\n"},{"id":"84255","messageId":"alpine.DEB.1.00.0807220147320.3407@eeepc-johanness","threadId":"14575","inReplyTo":"1216667998-8879-3-git-send-email-johannes.sixt@telecom.at","subject":"Re: [PATCH 2/9] Makefile: Normalize $(bindir) and $(gitexecdir) before comparing","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-21T23:48:08Z","receivedAt":"2008-07-21T23:48:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 21 Jul 2008, Johannes Sixt wrote:\n\n> +\tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n> +\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexecdir_SQ)' && pwd) && \\\n\nThese lack quotes, no?\n\nCiao,\nDscho\n"},{"id":"84293","messageId":"48858B61.5070300@viscovery.net","threadId":"14575","inReplyTo":"alpine.DEB.1.00.0807220147320.3407@eeepc-johanness","subject":"Re: [PATCH 2/9] Makefile: Normalize $(bindir) and $(gitexecdir) before comparing","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-07-22T07:25:21Z","receivedAt":"2008-07-22T07:25:21Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Schindelin schrieb:\n> Hi,\n> \n> On Mon, 21 Jul 2008, Johannes Sixt wrote:\n> \n>> +\tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n>> +\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexecdir_SQ)' && pwd) && \\\n> \n> These lack quotes, no?\n\nNo. RHS of an assignment doesn't need quotes as long as the shell syntax\nmakes clear where the assignment ends, which is the case here because of\nthe brackets $(...).\n\n-- Hannes\n"},{"id":"84350","messageId":"200807222131.32828.johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"alpine.DEB.1.00.0807220140170.3407@eeepc-johanness","subject":"Re: [PATCH 0/9] Make gitexecdir relative to $(bindir) on Windows","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-22T19:31:32Z","receivedAt":"2008-07-22T19:31:32Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Dienstag, 22. Juli 2008, Johannes Schindelin wrote:\n> Hi,\n>\n> On Mon, 21 Jul 2008, Johannes Sixt wrote:\n> > The problem was that argv[0] does not have a path in certain cases.\n>\n> Note that the same holds true for Linux when calling a program that is in\n> the PATH:\n\nOh, boy!\n\n> I imagine that the proper solution would be to rip out lookup_prog() and\n> use it for non-Windows Git, too.  Unless you want to limit the usefulness\n> of your patch series to Windows, that is.\n\nThis certainly goes beyond what I am prepared to do. It is not my itch. The \nseries is already much longer than I wanted, when there is a much simpler \nsolution that solves *my* problem: to set bindir = $(gitexecdir).\n\n-- Hannes\n"},{"id":"84565","messageId":"7vmyk8e9p9.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"200807222131.32828.johannes.sixt@telecom.at","subject":"Re: [PATCH 0/9] Make gitexecdir relative to $(bindir) on Windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-23T18:28:50Z","receivedAt":"2008-07-23T18:28:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> On Dienstag, 22. Juli 2008, Johannes Schindelin wrote:\n>> Hi,\n>>\n>> On Mon, 21 Jul 2008, Johannes Sixt wrote:\n>> > The problem was that argv[0] does not have a path in certain cases.\n>>\n>> Note that the same holds true for Linux when calling a program that is in\n>> the PATH:\n>\n> Oh, boy!\n>\n>> I imagine that the proper solution would be to rip out lookup_prog() and\n>> use it for non-Windows Git, too.  Unless you want to limit the usefulness\n>> of your patch series to Windows, that is.\n>\n> This certainly goes beyond what I am prepared to do. It is not my itch. The \n> series is already much longer than I wanted, when there is a much simpler \n> solution that solves *my* problem: to set bindir = $(gitexecdir).\n\nIf you are living in the Windows world, perhaps you could record the\ninstallation location in resource somewhere from the installer and look it\nup at runtime?  Or is it considered a bad practice?\n"},{"id":"84566","messageId":"7vfxq0e9lk.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"1216667998-8879-6-git-send-email-johannes.sixt@telecom.at","subject":"Re: [PATCH 5/9] Allow the built-in exec path to be relative to the command invocation path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-23T18:31:03Z","receivedAt":"2008-07-23T18:31:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> If $(gitexecdir) is relative, it is interpreted relative to the command's\n> invocation path, which usually is $(bindir).\n>\n> The Makefile rules were written with the assumption that $(gitexecdir) is\n> an absolute path. We introduce a separate variable that names the\n> (absolute) installation directory.\n>  ... \n> +ifeq ($(firstword $(subst /, ,$(gitexecdir))),..)\n> +gitexec_instdir = $(bindir)/$(gitexecdir)\n> +else\n\nCan we please have a brief comment in the Makefile near we define mandir,\ninfodir, gitexecdir and friends about this \"relative to $(bindir)\"\nbusiness?\n\nPerhaps like:\n\n Makefile |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 23f2185..8fa8f9a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -171,6 +171,12 @@ ALL_LDFLAGS = $(LDFLAGS)\n STRIP ?= strip\n \n prefix = $(HOME)\n+\n+# Among these variables, gitexecdir and/or template_dir can be\n+# specified as a relative path ../some/where/else; this is interpreted\n+# as relative to $(bindir) and \"git\" at runtime figures out where they\n+# are based on the path to the executable.  This can help installing the\n+# suite in a relocatable way.\n bindir = $(prefix)/bin\n mandir = $(prefix)/share/man\n infodir = $(prefix)/share/info\n\nNote that I just listed two variables out of thin air without studying;\nyou might be making other variables capable of relative path, in which\ncase they should also be listed there.\n"},{"id":"84572","messageId":"200807232049.18686.johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"7vmyk8e9p9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 0/9] Make gitexecdir relative to $(bindir) on Windows","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-23T18:49:18Z","receivedAt":"2008-07-23T18:49:18Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Mittwoch, 23. Juli 2008, Junio C Hamano wrote:\n> Johannes Sixt <johannes.sixt@telecom.at> writes:\n> > On Dienstag, 22. Juli 2008, Johannes Schindelin wrote:\n> >> On Mon, 21 Jul 2008, Johannes Sixt wrote:\n> >> > The problem was that argv[0] does not have a path in certain cases.\n> >>\n> >> Note that the same holds true for Linux when calling a program that is\n> >> in the PATH:\n> >\n> > Oh, boy!\n> >\n> >> I imagine that the proper solution would be to rip out lookup_prog() and\n> >> use it for non-Windows Git, too.  Unless you want to limit the\n> >> usefulness of your patch series to Windows, that is.\n> >\n> > This certainly goes beyond what I am prepared to do. It is not my itch.\n> > The series is already much longer than I wanted, when there is a much\n> > simpler solution that solves *my* problem: to set bindir = $(gitexecdir).\n>\n> If you are living in the Windows world, perhaps you could record the\n> installation location in resource somewhere from the installer and look it\n> up at runtime?  Or is it considered a bad practice?\n\nWell, looking at value of _pgmptr *is* \"look it up at runtime\"; no resources \nor help from the installer are needed.\n\nMy rant here is more about that I created a *long* patch series only to find \nout that it does not have enough genericity to solve the same problem \n(relocatability) on platforms other than Windows - and I don't want to make \nit even longer. Windows is special enough that *I* could live with a much \nsimpler solution even though it is a bit retro.\n\n-- Hannes\n"},{"id":"84584","messageId":"200807232112.18352.johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"7vfxq0e9lk.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-23T19:12:18Z","receivedAt":"2008-07-23T19:12:18Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"If GIT_EXEC_PATH (the macro that is defined in the Makefile) is relative,\nit is interpreted relative to the command's invocation path, which usually\nis $(bindir).\n\nThe Makefile rules were written with the assumption that $(gitexecdir) is\nan absolute path. We introduce a separate variable that names the\n(absolute) installation directory.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\nOn Mittwoch, 23. Juli 2008, Junio C Hamano wrote:\n> Johannes Sixt <johannes.sixt@telecom.at> writes:\n> > If $(gitexecdir) is relative, it is interpreted relative to the command's\n> > invocation path, which usually is $(bindir).\n> >\n> > The Makefile rules were written with the assumption that $(gitexecdir) is\n> > an absolute path. We introduce a separate variable that names the\n> > (absolute) installation directory.\n> >  ...\n> > +ifeq ($(firstword $(subst /, ,$(gitexecdir))),..)\n> > +gitexec_instdir = $(bindir)/$(gitexecdir)\n> > +else\n>\n> Can we please have a brief comment in the Makefile near we define mandir,\n> infodir, gitexecdir and friends about this \"relative to $(bindir)\"\n> business?\n\nHere it is.\n\nIt also fixes 'make install' of git-gui as well (sigh!) by not exporting\ngitexecdir - assuming that Shawn applies the git-gui patch.\n\nThe first two hunks are new compared to v1 of this patch.\n\n-- Hannes\n\n Makefile   |   28 +++++++++++++++++++++++-----\n exec_cmd.c |   38 ++------------------------------------\n 2 files changed, 25 insertions(+), 41 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 23f2185..4f19b52 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -170,6 +170,16 @@ ALL_CFLAGS = $(CFLAGS)\n ALL_LDFLAGS = $(LDFLAGS)\n STRIP ?= strip\n \n+# Among the variables below, these:\n+#   gitexecdir\n+#   template_dir\n+#   htmldir\n+#   ETC_GITCONFIG (but not sysconfdir)\n+# can be specified as a relative path ../some/where/else (which must begin\n+# with ../); this is interpreted as relative to $(bindir) and \"git\" at\n+# runtime figures out where they are based on the path to the executable.\n+# This can help installing the suite in a relocatable way.\n+\n prefix = $(HOME)\n bindir = $(prefix)/bin\n mandir = $(prefix)/share/man\n@@ -205,7 +215,7 @@ GITWEB_FAVICON = git-favicon.png\n GITWEB_SITE_HEADER =\n GITWEB_SITE_FOOTER =\n \n-export prefix bindir gitexecdir sharedir htmldir sysconfdir\n+export prefix bindir sharedir htmldir sysconfdir\n \n CC = gcc\n AR = ar\n@@ -1316,10 +1326,18 @@ template_instdir = $(template_dir)\n endif\n export template_instdir\n \n+ifeq ($(firstword $(subst /, ,$(gitexecdir))),..)\n+gitexec_instdir = $(bindir)/$(gitexecdir)\n+else\n+gitexec_instdir = $(gitexecdir)\n+endif\n+gitexec_instdir_SQ = $(subst ','\\'',$(gitexec_instdir))\n+export gitexec_instdir\n+\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n-\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'\n-\t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n+\t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) git$X git-upload-pack$X git-receive-pack$X \ngit-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n@@ -1328,10 +1346,10 @@ ifndef NO_TCLTK\n \t$(MAKE) -C git-gui install\n endif\n ifneq (,$X)\n-\t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), \n$(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n+\t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), \n$(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)\n endif\n \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n-\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexecdir_SQ)' && pwd) && \\\n+\texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n \tthen \\\n \t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\ndiff --git a/exec_cmd.c b/exec_cmd.c\nindex 45f92eb..c236034 100644\n--- a/exec_cmd.c\n+++ b/exec_cmd.c\n@@ -7,40 +7,6 @@ extern char **environ;\n static const char *argv_exec_path;\n static const char *argv0_path;\n \n-static const char *builtin_exec_path(void)\n-{\n-#ifndef __MINGW32__\n-\treturn GIT_EXEC_PATH;\n-#else\n-\tint len;\n-\tchar *p, *q, *sl;\n-\tstatic char *ep;\n-\tif (ep)\n-\t\treturn ep;\n-\n-\tlen = strlen(_pgmptr);\n-\tif (len < 2)\n-\t\treturn ep = \".\";\n-\n-\tp = ep = xmalloc(len+1);\n-\tq = _pgmptr;\n-\tsl = NULL;\n-\t/* copy program name, turn '\\\\' into '/', skip last part */\n-\twhile ((*p = *q)) {\n-\t\tif (*q == '\\\\' || *q == '/') {\n-\t\t\t*p = '/';\n-\t\t\tsl = p;\n-\t\t}\n-\t\tp++, q++;\n-\t}\n-\tif (sl)\n-\t\t*sl = '\\0';\n-\telse\n-\t\tep[0] = '.', ep[1] = '\\0';\n-\treturn ep;\n-#endif\n-}\n-\n const char *system_path(const char *path)\n {\n \tif (!is_absolute_path(path) && argv0_path) {\n@@ -75,7 +41,7 @@ const char *git_exec_path(void)\n \t\treturn env;\n \t}\n \n-\treturn builtin_exec_path();\n+\treturn system_path(GIT_EXEC_PATH);\n }\n \n static void add_path(struct strbuf *out, const char *path)\n@@ -99,7 +65,7 @@ void setup_path(void)\n \n \tadd_path(&new_path, argv_exec_path);\n \tadd_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));\n-\tadd_path(&new_path, builtin_exec_path());\n+\tadd_path(&new_path, system_path(GIT_EXEC_PATH));\n \tadd_path(&new_path, argv0_path);\n \n \tif (old_path)\n-- \n1.6.0.rc0.18.g6aef2\n"},{"id":"84669","messageId":"7vd4l37vz7.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"200807232112.18352.johannes.sixt@telecom.at","subject":"Re: [PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-24T04:21:48Z","receivedAt":"2008-07-24T04:21:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> It also fixes 'make install' of git-gui as well (sigh!) by not exporting\n> gitexecdir - assuming that Shawn applies the git-gui patch.\n\nYeah, this seems to break the install quite badly without git-gui patch.\n\nIf your PATH does not include the bindir you are installing the freshly\nbuilt git, then the Makefile in git-gui runs:\n\n\tifndef gitexecdir\n\t\tgitexecdir := $(shell git --exec-path)\n\tendif\n\nand miserably fails.  We can assume that somebody who builds and installs\ngit-gui as a standalone project already *has* an installed, working git on\n$PATH, so the above ifndef is Ok, but when git-gui is built as part of\ngit.git tree, we really should avoid triggering that codepath.\n"},{"id":"84783","messageId":"200807242124.14583.johannes.sixt@telecom.at","threadId":"14575","inReplyTo":"7vd4l37vz7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-24T19:24:13Z","receivedAt":"2008-07-24T19:24:13Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Donnerstag, 24. Juli 2008, Junio C Hamano wrote:\n> Johannes Sixt <johannes.sixt@telecom.at> writes:\n> > It also fixes 'make install' of git-gui as well (sigh!) by not exporting\n> > gitexecdir - assuming that Shawn applies the git-gui patch.\n>\n> Yeah, this seems to break the install quite badly without git-gui patch.\n\nIf you squash this in, we don't need the git-gui patch.\n\n-- Hannes\n\ndiff --git a/Makefile b/Makefile\nindex aab23a2..904150e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1344,7 +1344,7 @@ install: all\n \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n ifndef NO_TCLTK\n \t$(MAKE) -C gitk-git install\n-\t$(MAKE) -C git-gui install\n+\t$(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install\n endif\n ifneq (,$X)\n \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), \n$(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)\n"},{"id":"84831","messageId":"285D4249-DF1F-4C2A-B7D8-6A74A8A7AED7@zib.de","threadId":"14575","inReplyTo":"1216667998-8879-10-git-send-email-johannes.sixt@telecom.at","subject":"Re: [PATCH 9/9] Windows: Do not compile git-shell","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-07-25T04:43:52Z","receivedAt":"2008-07-25T04:43:52Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Junio,\nDo you plan to apply this patch anytime soon?  Currently,\nbuilding on MSYS fails when it comes to compiling git-shell.\nI am waiting for this patch to either pop up in your or\nHannes' master.  I need this patch before I can push new\n4msysgit branches (next, devel).  Should I apply it directly\nin 4msysgit?\n\nThis patch is not related to the rest of the exec-path series.\n\n\tSteffen\n"},{"id":"84833","messageId":"7v3aly5zz3.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"200807242124.14583.johannes.sixt@telecom.at","subject":"Re: [PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-25T04:50:40Z","receivedAt":"2008-07-25T04:50:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> On Donnerstag, 24. Juli 2008, Junio C Hamano wrote:\n>> Johannes Sixt <johannes.sixt@telecom.at> writes:\n>> > It also fixes 'make install' of git-gui as well (sigh!) by not exporting\n>> > gitexecdir - assuming that Shawn applies the git-gui patch.\n>>\n>> Yeah, this seems to break the install quite badly without git-gui patch.\n>\n> If you squash this in, we don't need the git-gui patch.\n\nThanks.\n\nI think this patch makes _more_ sense than the git-gui patch, actually.\n\nWithin the context of git.git project, we would want to force the\ninstallation directory of git-gui portion to be consistent with the main\nproject.\n\n> diff --git a/Makefile b/Makefile\n> index aab23a2..904150e 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1344,7 +1344,7 @@ install: all\n>  \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n>  ifndef NO_TCLTK\n>  \t$(MAKE) -C gitk-git install\n> -\t$(MAKE) -C git-gui install\n> +\t$(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install\n>  endif\n>  ifneq (,$X)\n>  \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), \n> $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)\n\nHowever, I have to wonder if it is the right thing to do, like your patch\ndoes, for \"git --exec-path\" to return \"../libexec/git-core/\" in a relative\nform, without saying what it is relative to.  Shouldn't we be showing the\nfull path after resolving that relative path to git executable?\n"},{"id":"84844","messageId":"1216974722.48898f82e80d6@webmail.eunet.at","threadId":"14575","inReplyTo":"7v3aly5zz3.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-07-25T08:32:02Z","receivedAt":"2008-07-25T08:32:02Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Zitat von Junio C Hamano <gitster@pobox.com>:\n> However, I have to wonder if it is the right thing to do, like your patch\n> does, for \"git --exec-path\" to return \"../libexec/git-core/\" in a relative\n> form, without saying what it is relative to.  Shouldn't we be showing the\n> full path after resolving that relative path to git executable?\n\nDoes it? \"git --exec-path\" calls git_exec_path(), and that now returns\nsystem_path(GIT_EXEC_PATH), and that is an absolute path, although it's\nnot normalized.\n\nOh, I see: You tested it on Linux, right? This patch series does not work\ncorrectly on Linux (Unix? bash?), as Dscho has pointed out, since argv[0]\ndoes not have a directory part if \"git\" is in $PATH. In this case, system_path()\njust returns its argument, which is the relative path. :-/\n\n-- Hannes\n"},{"id":"84846","messageId":"4889911A.4040204@viscovery.net","threadId":"14575","inReplyTo":"1216974722.48898f82e80d6@webmail.eunet.at","subject":"Re: [PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-07-25T08:38:50Z","receivedAt":"2008-07-25T08:38:50Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Sixt schrieb:\n> Oh, I see: You tested it on Linux, right? This patch series does not work\n> correctly on Linux (Unix? bash?), as Dscho has pointed out, since argv[0]\n\ndoes not work correctly on Linux... *iff gitexecdir is relative*\n\n> does not have a directory part if \"git\" is in $PATH. In this case, system_path()\n> just returns its argument, which is the relative path. :-/\n\n-- Hannes\n"},{"id":"85212","messageId":"488D104F.8080005@gmail.com","threadId":"14575","inReplyTo":"1216667998-8879-2-git-send-email-johannes.sixt@telecom.at","subject":"Re: [PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2008-07-28T00:18:23Z","receivedAt":"2008-07-28T00:18:23Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Johannes Sixt wrote:\n[...]\n> \n> diff --git a/Makefile b/Makefile\n> index 551bde9..cbab4f9 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1335,6 +1335,7 @@ endif\n>  \t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \\\n>  \tfi\n>  \t$(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)\n> +\t$(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'\n>  ifneq (,$X)\n>  \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n>  endif\n\nThis new action needs to be in a conditional to keep it from removing \nthe ONLY git executable when bindir and execdir are the same dir.\n"},{"id":"85250","messageId":"7vabg2v83o.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"488D104F.8080005@gmail.com","subject":"Re: [PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-28T06:24:59Z","receivedAt":"2008-07-28T06:24:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"A Large Angry SCM <gitzilla@gmail.com> writes:\n\n> Johannes Sixt wrote:\n> [...]\n>>\n>> diff --git a/Makefile b/Makefile\n>> index 551bde9..cbab4f9 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -1335,6 +1335,7 @@ endif\n>>  \t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \\\n>>  \tfi\n>>  \t$(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)\n>> +\t$(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'\n>>  ifneq (,$X)\n>>  \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n>>  endif\n>\n> This new action needs to be in a conditional to keep it from removing\n> the ONLY git executable when bindir and execdir are the same dir.\n\nHeh, I love bug reports that come immediately after I tag the tip of\n'master' as -rc1.\n"},{"id":"85253","messageId":"7v63qqv7ex.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"7vabg2v83o.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-28T06:39:50Z","receivedAt":"2008-07-28T06:39:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> This new action needs to be in a conditional to keep it from removing\n>> the ONLY git executable when bindir and execdir are the same dir.\n>\n> Heh, I love bug reports that come immediately after I tag the tip of\n> 'master' as -rc1.\n\nThis should do, but to be very honest, I really hate the output from the\nforeach that precedes this section.\n\n Makefile |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 798a2f2..92df61c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1362,7 +1362,10 @@ endif\n \t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n \tfi && \\\n \t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n-\t$(RM) \"$$execdir/git$X\" && \\\n+\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n+\tthen \\\n+\t\t$(RM) \"$$execdir/git$X\"; \\\n+\tfi && \\\n \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n install-doc:\n"},{"id":"85254","messageId":"7v1w1ev7ah.fsf@gitster.siamese.dyndns.org","threadId":"14575","inReplyTo":"7v3aly5zz3.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 5/9 v2] Allow the built-in exec path to be relative to the command invocation path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-28T06:42:30Z","receivedAt":"2008-07-28T06:42:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Johannes Sixt <johannes.sixt@telecom.at> writes:\n>\n>> On Donnerstag, 24. Juli 2008, Junio C Hamano wrote:\n>>> Johannes Sixt <johannes.sixt@telecom.at> writes:\n>>> > It also fixes 'make install' of git-gui as well (sigh!) by not exporting\n>>> > gitexecdir - assuming that Shawn applies the git-gui patch.\n>>>\n>>> Yeah, this seems to break the install quite badly without git-gui patch.\n>>\n>> If you squash this in, we don't need the git-gui patch.\n>\n> Thanks.\n>\n> I think this patch makes _more_ sense than the git-gui patch, actually.\n>\n> Within the context of git.git project, we would want to force the\n> installation directory of git-gui portion to be consistent with the main\n> project.\n\nWhat I wanted to say with the above is that the main Makefile is what has\nits own special need from git-gui/Makefile's point of view, so passing\nsuch customization from the main Makefile makes a lot of sense.\n\nI think this is also needed; I noticed it while trying the \"build on a\nmachine without any git installed\" exercise.\n\ndiff --git a/Makefile b/Makefile\nindex 798a2f2..52c67c1 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1067,7 +1067,7 @@ endif\n \n all::\n ifndef NO_TCLTK\n-\t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all\n+\t$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all\n \t$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all\n endif\n \t$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all\n"},{"id":"85266","messageId":"488DA242.3000508@gmail.com","threadId":"14575","inReplyTo":"7vabg2v83o.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2008-07-28T10:41:06Z","receivedAt":"2008-07-28T10:41:06Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> A Large Angry SCM <gitzilla@gmail.com> writes:\n> \n>> Johannes Sixt wrote:\n>> [...]\n>>> diff --git a/Makefile b/Makefile\n>>> index 551bde9..cbab4f9 100644\n>>> --- a/Makefile\n>>> +++ b/Makefile\n>>> @@ -1335,6 +1335,7 @@ endif\n>>>  \t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \\\n>>>  \tfi\n>>>  \t$(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)\n>>> +\t$(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'\n>>>  ifneq (,$X)\n>>>  \t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)\n>>>  endif\n>> This new action needs to be in a conditional to keep it from removing\n>> the ONLY git executable when bindir and execdir are the same dir.\n> \n> Heh, I love bug reports that come immediately after I tag the tip of\n> 'master' as -rc1.\n> \n\nWell, I'm currently about a week behind on all things git so this is as \ntimely as I could make it. ;-)\n"},{"id":"85267","messageId":"488DA2C2.4030003@gmail.com","threadId":"14575","inReplyTo":"7v63qqv7ex.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2008-07-28T10:43:14Z","receivedAt":"2008-07-28T10:43:14Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>>> This new action needs to be in a conditional to keep it from removing\n>>> the ONLY git executable when bindir and execdir are the same dir.\n>> Heh, I love bug reports that come immediately after I tag the tip of\n>> 'master' as -rc1.\n> \n> This should do, but to be very honest, I really hate the output from the\n> foreach that precedes this section.\n> \n>  Makefile |    5 ++++-\n>  1 files changed, 4 insertions(+), 1 deletions(-)\n> \n> diff --git a/Makefile b/Makefile\n> index 798a2f2..92df61c 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1362,7 +1362,10 @@ endif\n>  \t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n>  \tfi && \\\n>  \t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n> -\t$(RM) \"$$execdir/git$X\" && \\\n> +\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n> +\tthen \\\n> +\t\t$(RM) \"$$execdir/git$X\"; \\\n> +\tfi && \\\n>  \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n>  \n>  install-doc:\n> \n\nI'll test this this evening.\n"},{"id":"85352","messageId":"488E527C.4000901@gmail.com","threadId":"14575","inReplyTo":"7v63qqv7ex.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/9] Makefile: Do not install a copy of 'git' in $(gitexecdir)","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2008-07-28T23:13:00Z","receivedAt":"2008-07-28T23:13:00Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>>> This new action needs to be in a conditional to keep it from removing\n>>> the ONLY git executable when bindir and execdir are the same dir.\n>> Heh, I love bug reports that come immediately after I tag the tip of\n>> 'master' as -rc1.\n> \n> This should do, but to be very honest, I really hate the output from the\n> foreach that precedes this section.\n> \n>  Makefile |    5 ++++-\n>  1 files changed, 4 insertions(+), 1 deletions(-)\n> \n> diff --git a/Makefile b/Makefile\n> index 798a2f2..92df61c 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1362,7 +1362,10 @@ endif\n>  \t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n>  \tfi && \\\n>  \t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n> -\t$(RM) \"$$execdir/git$X\" && \\\n> +\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n> +\tthen \\\n> +\t\t$(RM) \"$$execdir/git$X\"; \\\n> +\tfi && \\\n>  \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n>  \n>  install-doc:\n> \n\nTested by: A Large Angry SCM <gitzilla@gmail.com>\n"}]}