Skip to content

Commit

Permalink
make "git unpack-file" a built-in
Browse files Browse the repository at this point in the history
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Jan 22, 2010
1 parent 112dd51 commit b532581
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ PROGRAMS += git-index-pack$X
PROGRAMS += git-pack-redundant$X
PROGRAMS += git-shell$X
PROGRAMS += git-show-index$X
PROGRAMS += git-unpack-file$X
PROGRAMS += git-upload-pack$X
PROGRAMS += git-http-backend$X

Expand Down Expand Up @@ -698,6 +697,7 @@ BUILTIN_OBJS += builtin-stripspace.o
BUILTIN_OBJS += builtin-symbolic-ref.o
BUILTIN_OBJS += builtin-tag.o
BUILTIN_OBJS += builtin-tar-tree.o
BUILTIN_OBJS += builtin-unpack-file.o
BUILTIN_OBJS += builtin-unpack-objects.o
BUILTIN_OBJS += builtin-update-index.o
BUILTIN_OBJS += builtin-update-ref.o
Expand Down
5 changes: 1 addition & 4 deletions unpack-file.c → builtin-unpack-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
git_config(git_default_config, NULL);

puts(create_temp_file(sha1));
Expand Down
1 change: 1 addition & 0 deletions builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
extern int cmd_tag(int argc, const char **argv, const char *prefix);
extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
extern int cmd_unpack_file(int argc, const char **argv, const char *prefix);
extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
extern int cmd_update_index(int argc, const char **argv, const char *prefix);
extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
Expand Down
1 change: 1 addition & 0 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
{ "tag", cmd_tag, RUN_SETUP },
{ "tar-tree", cmd_tar_tree },
{ "unpack-file", cmd_unpack_file, RUN_SETUP },
{ "unpack-objects", cmd_unpack_objects, RUN_SETUP },
{ "update-index", cmd_update_index, RUN_SETUP },
{ "update-ref", cmd_update_ref, RUN_SETUP },
Expand Down

0 comments on commit b532581

Please sign in to comment.