git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Scott R Parish <srp@srparish.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] use only the PATH for exec'ing git commands
Date: Mon, 22 Oct 2007 21:01:02 +0200	[thread overview]
Message-ID: <20071022190102.GA23714@steel.home> (raw)
In-Reply-To: <20071022170148.GB29642@srparish.net>

Scott R Parish, Mon, Oct 22, 2007 19:01:48 +0200:
> +static void add_path(struct strbuf *out, const char *path)
> +{
> +	if (path && strlen(path)) {
> +		if (is_absolute_path(path))
> +			strbuf_addstr(out, path);
> +		else
> +			strbuf_addstr(out, make_absolute_path(path));
> +
> +		strbuf_addch(out, ':');

Shouldn't it break MingW32 native port?

> +	}
> +}
> +
> +void setup_path(const char *cmd_path)
> +{
> +	const char *old_path = getenv("PATH");
> +	struct strbuf new_path;
> +
> +	strbuf_init(&new_path, 0);
> +
> +	add_path(&new_path, argv_exec_path);
> +	add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
> +	add_path(&new_path, builtin_exec_path);
> +	add_path(&new_path, cmd_path);
> +		

trailing space

> +	if (old_path)
> +		strbuf_addstr(&new_path, old_path);
> +	else 
> +		strbuf_addstr(&new_path, "/usr/local/bin:/usr/bin:/bin");

the default PATH is platform-dependent. Git is multi-platform.
You should consider putting the path list somewhere in Makefile,
config.mak or configure.

> +
> +	setenv("PATH", new_path.buf, 1);

  parent reply	other threads:[~2007-10-22 19:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 17:01 [PATCH] use only the PATH for exec'ing git commands Scott R Parish
2007-10-22 17:44 ` Johannes Schindelin
2007-10-22 19:01 ` Alex Riesen [this message]
2007-10-22 19:25   ` Eric Merritt
2007-10-23  4:08   ` [PATCH trailing ws fixed] " Scott Parish
2007-10-23 21:12     ` Alex Riesen
2007-10-23 21:27       ` [PATCH trailing ws fixed] use only the PATH for exec'ing gitcommands Scott R Parish
  -- strict thread matches above, loose matches on Subject: below --
2007-10-22 19:59 [PATCH] use only the PATH for exec'ing git commands Scott R Parish
2007-10-22 20:57 ` Alex Riesen
2007-10-22 19:59 Scott R Parish
2007-10-22 22:12 Scott R Parish
2007-10-22 22:40 ` Alex Riesen
2007-10-22 23:34   ` Johannes Schindelin
2007-10-23  6:14 ` 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=20071022190102.GA23714@steel.home \
    --to=raa.lkml@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).