From 069930410211632f2f8beea303771088226b523f Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sat, 17 Nov 2007 16:09:26 +0100 Subject: [PATCH] Use relative paths to make installation relocatable mingw uses relative paths for template_dir and ETC_GITCONFIG to make an installation relocatable. Relative paths will be expanded relative to git_exec_dir(). This mechanism is now included in official git.git. We used a different mechanism to create a relocatable installation. We used to prefix absolute Unix paths with the installation prefix, derived from the path of git.exe. This commit reverts our implementation to match mingw. Part of the change are reverts of the following commits, which are no longer needed: 4e8904080d62be07a139436aa44044e05e380a2c 0fbe22da392f39e1d144f78ef08b2dbdb882c164. 636116b8a79c7c810afe8ae8e4c37e0a1de6f7b7. Signed-off-by: Steffen Prohaska --- Makefile | 7 ++++--- builtin-init-db.c | 11 ----------- config.c | 11 ----------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 4c749a0357..8586fcd397 100644 --- a/Makefile +++ b/Makefile @@ -523,7 +523,8 @@ ifneq (,$(findstring MINGW,$(uname_S))) EXTLIBS += -lws2_32 X = .exe NOEXECTEMPL = .noexec - prefix = + template_dir = ../share/git-core/templates/ + ETC_GITCONFIG = ../etc/gitconfig endif ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease @@ -774,12 +775,12 @@ endif # Shell quote (do not use $(call) to accommodate ancient setups); SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) -ETC_GITCONFIG_SQ = \057etc/gitconfig +ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG)) DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) bindir_SQ = $(subst ','\'',$(bindir)) gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) -template_dir_SQ = \057share/git-core/templates +template_dir_SQ = $(subst ','\'',$(template_dir)) prefix_SQ = $(subst ','\'',$(prefix)) sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) diff --git a/builtin-init-db.c b/builtin-init-db.c index 2feec40eb6..bb132ec086 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -145,17 +145,6 @@ static void copy_templates(const char *git_dir, int len, const char *template_di template_dir = prefix_path(exec_path, strlen(exec_path), template_dir); } -#if __MINGW32__ - /* - * If it is an absolute Unix path it is prefixed with - * the git_install_prefix(). - */ - else if (template_dir[0] == '/') { - const char* prefix = git_install_prefix(); - template_dir = prefix_path(prefix, strlen(prefix), - template_dir); - } -#endif } strcpy(template_path, template_dir); template_len = strlen(template_path); diff --git a/config.c b/config.c index 0b167ceb75..7b9ded1655 100644 --- a/config.c +++ b/config.c @@ -473,17 +473,6 @@ const char *git_etc_gitconfig(void) system_wide = prefix_path(exec_path, strlen(exec_path), system_wide); } -#if __MINGW32__ - /* - * If it is an absolute Unix path it is prefixed with - * the git_install_prefix(). - */ - else if (system_wide[0] == '/') { - const char* prefix = git_install_prefix(); - system_wide = prefix_path(prefix, strlen(prefix), - system_wide); - } -#endif } return system_wide; }