Browse Source

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>
maint
Linus Torvalds 15 years ago committed by Junio C Hamano
parent
commit
b28a1ce04c
  1. 2
      Makefile
  2. 5
      builtin-hash-object.c
  3. 1
      builtin.h
  4. 1
      git.c

2
Makefile

@ -387,7 +387,6 @@ EXTRA_PROGRAMS =
# ... and all the rest that could be moved out of bindir to gitexecdir # ... and all the rest that could be moved out of bindir to gitexecdir
PROGRAMS += $(EXTRA_PROGRAMS) PROGRAMS += $(EXTRA_PROGRAMS)
PROGRAMS += git-fast-import$X PROGRAMS += git-fast-import$X
PROGRAMS += git-hash-object$X
PROGRAMS += git-imap-send$X PROGRAMS += git-imap-send$X
PROGRAMS += git-index-pack$X PROGRAMS += git-index-pack$X
PROGRAMS += git-merge-index$X PROGRAMS += git-merge-index$X
@ -658,6 +657,7 @@ BUILTIN_OBJS += builtin-for-each-ref.o
BUILTIN_OBJS += builtin-fsck.o BUILTIN_OBJS += builtin-fsck.o
BUILTIN_OBJS += builtin-gc.o BUILTIN_OBJS += builtin-gc.o
BUILTIN_OBJS += builtin-grep.o BUILTIN_OBJS += builtin-grep.o
BUILTIN_OBJS += builtin-hash-object.o
BUILTIN_OBJS += builtin-help.o BUILTIN_OBJS += builtin-help.o
BUILTIN_OBJS += builtin-init-db.o BUILTIN_OBJS += builtin-init-db.o
BUILTIN_OBJS += builtin-log.o BUILTIN_OBJS += builtin-log.o

5
hash-object.c → builtin-hash-object.c

@ -73,17 +73,14 @@ static const struct option hash_object_options[] = {
OPT_END() OPT_END()
}; };


int main(int argc, const char **argv) int cmd_hash_object(int argc, const char **argv, const char *prefix)
{ {
int i; int i;
const char *prefix = NULL;
int prefix_length = -1; int prefix_length = -1;
const char *errstr = NULL; const char *errstr = NULL;


type = blob_type; type = blob_type;


git_extract_argv0_path(argv[0]);

argc = parse_options(argc, argv, NULL, hash_object_options, argc = parse_options(argc, argv, NULL, hash_object_options,
hash_object_usage, 0); hash_object_usage, 0);


1
builtin.h

@ -55,6 +55,7 @@ extern int cmd_fsck(int argc, const char **argv, const char *prefix);
extern int cmd_gc(int argc, const char **argv, const char *prefix); extern int cmd_gc(int argc, const char **argv, const char *prefix);
extern int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix); extern int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
extern int cmd_grep(int argc, const char **argv, const char *prefix); extern int cmd_grep(int argc, const char **argv, const char *prefix);
extern int cmd_hash_object(int argc, const char **argv, const char *prefix);
extern int cmd_help(int argc, const char **argv, const char *prefix); extern int cmd_help(int argc, const char **argv, const char *prefix);
extern int cmd_http_fetch(int argc, const char **argv, const char *prefix); extern int cmd_http_fetch(int argc, const char **argv, const char *prefix);
extern int cmd_init_db(int argc, const char **argv, const char *prefix); extern int cmd_init_db(int argc, const char **argv, const char *prefix);

1
git.c

@ -318,6 +318,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "gc", cmd_gc, RUN_SETUP }, { "gc", cmd_gc, RUN_SETUP },
{ "get-tar-commit-id", cmd_get_tar_commit_id }, { "get-tar-commit-id", cmd_get_tar_commit_id },
{ "grep", cmd_grep, USE_PAGER }, { "grep", cmd_grep, USE_PAGER },
{ "hash-object", cmd_hash_object },
{ "help", cmd_help }, { "help", cmd_help },
{ "init", cmd_init_db }, { "init", cmd_init_db },
{ "init-db", cmd_init_db }, { "init-db", cmd_init_db },

Loading…
Cancel
Save