[PATCH] Wrap RUNTIME_PREFIX warning in a compile-time condition

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Sixt
Date: Tuesday, February 23, 2010 - 1:32 am

From: Johannes Sixt <j6t@kdbg.org>

When RUNTIME_PREFIX is enabled, the installation prefix is derived by
trying a limited set of known locations where the git executable can
reside. If none of these is found, a warning is emitted.

When git is built in a directory that matches neither of these known names,
the warning would always be emitted when the uninstalled executable is run.
This is a problem on Windows, where gitk picks the uninstalled git when
invoked on the build directory and gets confused by the warning.

With this patch, individual developers can disable the warning by setting

   BASIC_CFLAGS += -DNO_WARN_RUNTIME_PREFIX

in config.mak.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 exec_cmd.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/exec_cmd.c b/exec_cmd.c
index 408e4e5..5a22635 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -28,9 +28,11 @@ const char *system_path(const char *path)
 	    !(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
 	    !(prefix = strip_path_suffix(argv0_path, "git"))) {
 		prefix = PREFIX;
+#ifndef NO_WARN_RUNTIME_PREFIX
 		fprintf(stderr, "RUNTIME_PREFIX requested, "
 				"but prefix computation failed.  "
 				"Using static fallback '%s'.\n", prefix);
+#endif
 	}
 #endif

-- 
1.7.0.84.g6ef09

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Wrap RUNTIME_PREFIX warning in a compile-time cond ..., Johannes Sixt, (Tue Feb 23, 1:32 am)
Re: [PATCH] Wrap RUNTIME_PREFIX warning in a compile-time ..., Johannes Schindelin, (Tue Feb 23, 2:42 am)
Re: [PATCH] Wrap RUNTIME_PREFIX warning in a compile-time ..., Johannes Schindelin, (Tue Feb 23, 3:03 am)
Re: [PATCH] Wrap RUNTIME_PREFIX warning in a compile-time ..., Johannes Schindelin, (Tue Feb 23, 4:07 am)
Re: [PATCH] Print RUNTIME_PREFIX warning only when GIT_TRA ..., Johannes Schindelin, (Tue Feb 23, 5:57 am)