All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] git-help: find library man pages again
@ 2010-09-01 16:02 Michael J Gruber
  2010-09-01 16:07 ` Michael J Gruber
  2010-09-02  8:16 ` Jonathan Nieder
  0 siblings, 2 replies; 7+ messages in thread
From: Michael J Gruber @ 2010-09-01 16:02 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, Jeff King

46bac90 (Do not install shell libraries executable, 2010-01-31) changed
the executable bits of shell variables in order to avoid false reports
from valgrind. As a side effect, this inhibits "git help" from finding
the corresponding man pages because list_command_in_dir() (called by
load_command_list()) checks that bit.

Short of reverting that and appeasing  valgrind in another way, make
list_command_in_dir() ignore the executable bit when looking in the exec
dir, so that the following man pages are found again by "git-help":

git-mergetool--lib
git-parse-remote
git-sh-setup

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Notes:
    This does not help with the man page for git-remote-helpers which is installed
    but not found by git-help either. That is a different issue, though.

 help.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/help.c b/help.c
index 7f4928e..451899c 100644
--- a/help.c
+++ b/help.c
@@ -146,8 +146,9 @@ static int is_executable(const char *name)
 }
 
 static void list_commands_in_dir(struct cmdnames *cmds,
-					 const char *path,
-					 const char *prefix)
+					const char *path,
+					const char *prefix,
+					int checkexec)
 {
 	int prefix_len;
 	DIR *dir = opendir(path);
@@ -172,7 +173,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
 
 		strbuf_setlen(&buf, len);
 		strbuf_addstr(&buf, de->d_name);
-		if (!is_executable(buf.buf))
+		if (checkexec && !is_executable(buf.buf))
 			continue;
 
 		entlen = strlen(de->d_name) - prefix_len;
@@ -193,7 +194,7 @@ void load_command_list(const char *prefix,
 	const char *exec_path = git_exec_path();
 
 	if (exec_path) {
-		list_commands_in_dir(main_cmds, exec_path, prefix);
+		list_commands_in_dir(main_cmds, exec_path, prefix, 0);
 		qsort(main_cmds->names, main_cmds->cnt,
 		      sizeof(*main_cmds->names), cmdname_compare);
 		uniq(main_cmds);
@@ -206,7 +207,7 @@ void load_command_list(const char *prefix,
 			if ((colon = strchr(path, PATH_SEP)))
 				*colon = 0;
 			if (!exec_path || strcmp(path, exec_path))
-				list_commands_in_dir(other_cmds, path, prefix);
+				list_commands_in_dir(other_cmds, path, prefix, 1);
 
 			if (!colon)
 				break;
-- 
1.7.2.2.540.g9d56f.dirty

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-09 19:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-01 16:02 [RFC PATCH] git-help: find library man pages again Michael J Gruber
2010-09-01 16:07 ` Michael J Gruber
2010-09-02  8:16 ` Jonathan Nieder
2010-09-02  8:41   ` Michael J Gruber
2010-09-02  8:55     ` Jonathan Nieder
2010-09-02  9:09       ` Michael J Gruber
2010-09-09 19:58     ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.