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

make "git hash-object" 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 21, 2010 at 19:50 UTC b28a1ce04cdafbd3b470ec43c0f562054bd45d4d
4 files changed +4 -5
Makefile
+1 -1
@@ -387,7 +387,6 @@ EXTRA_PROGRAMS =
387 # ... and all the rest that could be moved out of bindir to gitexecdir
388 PROGRAMS += $(EXTRA_PROGRAMS)
389 PROGRAMS += git-fast-import$X
390 -PROGRAMS += git-hash-object$X
390 PROGRAMS += git-imap-send$X
391 PROGRAMS += git-index-pack$X
392 PROGRAMS += git-merge-index$X
@@ -658,6 +657,7 @@ BUILTIN_OBJS += builtin-for-each-ref.o
657 BUILTIN_OBJS += builtin-fsck.o
658 BUILTIN_OBJS += builtin-gc.o
659 BUILTIN_OBJS += builtin-grep.o
660 +BUILTIN_OBJS += builtin-hash-object.o
661 BUILTIN_OBJS += builtin-help.o
662 BUILTIN_OBJS += builtin-init-db.o
663 BUILTIN_OBJS += builtin-log.o
builtin-hash-object.c renamed
+1 -4
@@ -73,17 +73,14 @@ static const struct option hash_object_options[] = {
73 OPT_END()
74 };
75
76 -int main(int argc, const char **argv)
76 +int cmd_hash_object(int argc, const char **argv, const char *prefix)
77 {
78 int i;
79 - const char *prefix = NULL;
79 int prefix_length = -1;
80 const char *errstr = NULL;
81
82 type = blob_type;
83
85 - git_extract_argv0_path(argv[0]);
86 -
84 argc = parse_options(argc, argv, NULL, hash_object_options,
85 hash_object_usage, 0);
86
builtin.h
+1
@@ -55,6 +55,7 @@ extern int cmd_fsck(int argc, const char **argv, const char *prefix);
55 extern int cmd_gc(int argc, const char **argv, const char *prefix);
56 extern int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
57 extern int cmd_grep(int argc, const char **argv, const char *prefix);
58 +extern int cmd_hash_object(int argc, const char **argv, const char *prefix);
59 extern int cmd_help(int argc, const char **argv, const char *prefix);
60 extern int cmd_http_fetch(int argc, const char **argv, const char *prefix);
61 extern int cmd_init_db(int argc, const char **argv, const char *prefix);
git.c
+1
@@ -318,6 +318,7 @@ static void handle_internal_command(int argc, const char **argv)
318 { "gc", cmd_gc, RUN_SETUP },
319 { "get-tar-commit-id", cmd_get_tar_commit_id },
320 { "grep", cmd_grep, USE_PAGER },
321 + { "hash-object", cmd_hash_object },
322 { "help", cmd_help },
323 { "init", cmd_init_db },
324 { "init-db", cmd_init_db },