Re: [PATCH 3/5] make "git unpack-file" a built-in

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 3/5] make "git unpack-file" a built-in

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:05

Linus Torvalds [off-list ref] writes:
quoted hunk
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Jan 2010 07:38:03 -0800

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
Again.. No surprises.
...
diff --git a/unpack-file.c b/builtin-unpack-file.c
similarity index 89%
rename from unpack-file.c
rename to builtin-unpack-file.c
index e9d8934..608590a 100644
--- a/unpack-file.c
+++ b/builtin-unpack-file.c
@@ -22,18 +22,15 @@ static char *create_temp_file(unsigned char *sha1)
 	return path;
 }
 
-int main(int argc, char **argv)
+int cmd_unpack_file(int argc, const char **argv, const char *prefix)
 {
 	unsigned char sha1[20];
 
-	git_extract_argv0_path(argv[0]);
-
 	if (argc != 2 || !strcmp(argv[1], "-h"))
 		usage("git unpack-file <sha1>");
 	if (get_sha1(argv[1], sha1))
 		die("Not a valid object name %s", argv[1]);
 
-	setup_git_directory();
This will now require "git unpack-file -h" to be run in a git controlled
directory, so strictly speaking it changes behaviour.

Not that anybody would care that much, though.

Re: [PATCH 3/5] make "git unpack-file" a built-in

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:48:05


On Fri, 22 Jan 2010, Junio C Hamano wrote:
quoted
 {
 	unsigned char sha1[20];
 
-	git_extract_argv0_path(argv[0]);
-
 	if (argc != 2 || !strcmp(argv[1], "-h"))
 		usage("git unpack-file <sha1>");
 	if (get_sha1(argv[1], sha1))
 		die("Not a valid object name %s", argv[1]);
 
-	setup_git_directory();
This will now require "git unpack-file -h" to be run in a git controlled
directory, so strictly speaking it changes behaviour.

Not that anybody would care that much, though.
Heh. You didn't notice the same change in the merge-tree conversion that 
you already accepted ;)

Yeah, any usage messages will now run after setup for the commands that do 
the whole RUN_SETUP thing. That's pack-redundant, unpack-file, mktag, 
merge-index and merge-tree. So they'll now report "Not a git repository" 
before they report invalid arguments.

			Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help