git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH] git-help: find library man pages again

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Sep 1, 2010, 16:02 UTC
Message-ID
<0b8d803551f495e2494b43c6d95163daca82f62b.1283356852.git.git@drmicha.warpmail.net>

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
Next: Michael J Gruber
Message 1 of 7 in “git-help: find library man pages again”
  1. git-help: find library man pages againMichael J Gruber, Sep 1, 2010
  2. Michael J GruberSep 1, 2010
  3. Jonathan NiederSep 2, 2010
  4. Michael J GruberSep 2, 2010
  5. Jonathan NiederSep 2, 2010
  6. Michael J GruberSep 2, 2010
  7. Jeff KingSep 9, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.