From: "Shawn O. Pearce" <spearce@spearce.org>
To: Scott R Parish <srp@srparish.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] "git help -a" should search all exec_paths and PATH
Date: Mon, 22 Oct 2007 01:30:17 -0400 [thread overview]
Message-ID: <20071022053016.GN14735@spearce.org> (raw)
In-Reply-To: <20071021214846.GI16291@srparish.net>
Scott R Parish <srp@srparish.net> wrote:
> Currently "git help -a" only searches in the highest priority exec_path,
> meaning at worst, nothing is listed if the git commands are only available
> from the PATH. It also makes git slightly less extensible.
...
> extern char **environ;
> static const char *builtin_exec_path = GIT_EXEC_PATH;
> -static const char *current_exec_path;
> +static const char *argv_exec_path;
>
> -void git_set_exec_path(const char *exec_path)
> +void git_set_argv_exec_path(const char *exec_path)
> {
> - current_exec_path = exec_path;
> + argv_exec_path = exec_path;
> }
I'd rather see a rename isolated from a logic change. I find
it easier to review.
> +const char *git_argv_exec_path(void)
> +const char *git_builtin_exec_path(void)
> +const char *git_env_exec_path(void)
And yet later you then build the same priority array as already used
by execv_git_cmd(). Why not just make a function that builds the
array for the caller, so both execv_git_cmd() and list_commands()
can both use the same array?
> +static unsigned int list_commands_in_dir(const char *dir, const char *prefix)
> {
> + int start_dir = open(".", O_RDONLY, 0);
...
> + if (!dirp || chdir(dir)) {
> + fchdir(start_dir);
fchdir() isn't as portable as Git currently is. Thus far we have
avoided using fchdir(). Requiring it here for something as "simple"
as listing help is not a good improvement as it will limit who can
run git-help. Why can't you stat the individual entries by joining
the paths together?
--
Shawn.
next prev parent reply other threads:[~2007-10-22 5:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-21 21:48 [PATCH] "git help -a" should search all exec_paths and PATH Scott R Parish
2007-10-21 22:25 ` Johannes Schindelin
2007-10-22 0:54 ` Scott Parish
2007-10-22 5:30 ` Shawn O. Pearce [this message]
2007-10-22 6:32 ` Scott Parish
2007-10-22 6:39 ` Shawn O. Pearce
2007-10-22 6:06 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071022053016.GN14735@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=srp@srparish.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.