@matheusbsbs / matheus-bagliano / commits / b53258182b
Fork 0

make "git unpack-file" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Linus Torvalds committed Jan 22, 2010 at 07:38 UTC b53258182bf90b4fb922a20d164a02e6f0e9afd1
4 files changed +4 -5
Makefile
+1 -1
@@ -392,7 +392,6 @@ PROGRAMS += git-index-pack$X
392 PROGRAMS += git-pack-redundant$X
393 PROGRAMS += git-shell$X
394 PROGRAMS += git-show-index$X
395 -PROGRAMS += git-unpack-file$X
395 PROGRAMS += git-upload-pack$X
396 PROGRAMS += git-http-backend$X
397
@@ -698,6 +697,7 @@ BUILTIN_OBJS += builtin-stripspace.o
697 BUILTIN_OBJS += builtin-symbolic-ref.o
698 BUILTIN_OBJS += builtin-tag.o
699 BUILTIN_OBJS += builtin-tar-tree.o
700 +BUILTIN_OBJS += builtin-unpack-file.o
701 BUILTIN_OBJS += builtin-unpack-objects.o
702 BUILTIN_OBJS += builtin-update-index.o
703 BUILTIN_OBJS += builtin-update-ref.o
builtin-unpack-file.c renamed
+1 -4
@@ -22,18 +22,15 @@ static char *create_temp_file(unsigned char *sha1)
22 return path;
23 }
24
25 -int main(int argc, char **argv)
25 +int cmd_unpack_file(int argc, const char **argv, const char *prefix)
26 {
27 unsigned char sha1[20];
28
29 - git_extract_argv0_path(argv[0]);
30 -
29 if (argc != 2 || !strcmp(argv[1], "-h"))
30 usage("git unpack-file <sha1>");
31 if (get_sha1(argv[1], sha1))
32 die("Not a valid object name %s", argv[1]);
33
36 - setup_git_directory();
34 git_config(git_default_config, NULL);
35
36 puts(create_temp_file(sha1));
builtin.h
+1
@@ -103,6 +103,7 @@ extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
103 extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
104 extern int cmd_tag(int argc, const char **argv, const char *prefix);
105 extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
106 +extern int cmd_unpack_file(int argc, const char **argv, const char *prefix);
107 extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
108 extern int cmd_update_index(int argc, const char **argv, const char *prefix);
109 extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
git.c
+1
@@ -370,6 +370,7 @@ static void handle_internal_command(int argc, const char **argv)
370 { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
371 { "tag", cmd_tag, RUN_SETUP },
372 { "tar-tree", cmd_tar_tree },
373 + { "unpack-file", cmd_unpack_file, RUN_SETUP },
374 { "unpack-objects", cmd_unpack_objects, RUN_SETUP },
375 { "update-index", cmd_update_index, RUN_SETUP },
376 { "update-ref", cmd_update_ref, RUN_SETUP },