Subject: Re: [PATCH] get_sha1: support relative path "<obj>:<sth>" syntax

From: Jonathan Nieder <[email-masked]>
Date: Wed, 10 Nov 2010 11:47:36 -0600

Nguyễn Thái Ngọc Duy wrote:

> This does not work in commands that startup_info is NULL
> (i.e. non-builtin ones).

That is easily fixable, no?

The non-builtins are:

	fast-import
	imap-send
	shell
	daemon
	show-index
	upload-pack
	http-backend
	http-fetch
	http-push

Of those, only fast-import might have a possible reason need to know
about this new syntax.

Signed-off-by: Jonathan Nieder <[email-masked]>
---
 Assuming your patch builds on acf4823a (setup: save prefix (original
 cwd relative to toplevel) in startup_info, 2010-10-24).

 Untested.

diff --git a/fast-import.c b/fast-import.c
index 77549eb..3b597e8 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2923,8 +2923,11 @@ static void parse_argv(void)
 
 int main(int argc, const char **argv)
 {
+	static struct startup_info git_startup_info;
 	unsigned int i;
 
+	startup_info = &git_startup_info;
+
 	git_extract_argv0_path(argv[0]);
 
 	if (argc == 2 && !strcmp(argv[1], "-h"))