make "git patch-id" a built-in
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Jan 2010 04:31:25 +0000 (20:31 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2010 06:06:12 +0000 (22:06 -0800)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
builtin-patch-id.c [moved from patch-id.c with 95% similarity]
builtin.h
git.c

index 4558c4627bd2f46c11a33772c37f24602b28870e..e1c7ae58500916ac5adbd187029e7edcf8e6663f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -392,7 +392,6 @@ PROGRAMS += git-index-pack$X
 PROGRAMS += git-merge-index$X
 PROGRAMS += git-mktag$X
 PROGRAMS += git-pack-redundant$X
-PROGRAMS += git-patch-id$X
 PROGRAMS += git-shell$X
 PROGRAMS += git-show-index$X
 PROGRAMS += git-unpack-file$X
@@ -676,6 +675,7 @@ BUILTIN_OBJS += builtin-mv.o
 BUILTIN_OBJS += builtin-name-rev.o
 BUILTIN_OBJS += builtin-pack-objects.o
 BUILTIN_OBJS += builtin-pack-refs.o
+BUILTIN_OBJS += builtin-patch-id.o
 BUILTIN_OBJS += builtin-prune-packed.o
 BUILTIN_OBJS += builtin-prune.o
 BUILTIN_OBJS += builtin-push.o
similarity index 95%
rename from patch-id.c
rename to builtin-patch-id.c
index 0df4cb086ba26d1f4d56b8347a6a7bcf219832f5..af0911e4bd54848eadc7485c985e2a010e720e7f 100644 (file)
@@ -75,13 +75,11 @@ static void generate_id_list(void)
 
 static const char patch_id_usage[] = "git patch-id < patch";
 
-int main(int argc, char **argv)
+int cmd_patch_id(int argc, const char **argv, const char *prefix)
 {
        if (argc != 1)
                usage(patch_id_usage);
 
-       git_extract_argv0_path(argv[0]);
-
        generate_id_list();
        return 0;
 }
index 2d95c3b2fe8a20f0cdb9070184689b3f63cca7eb..cb8489f97e4fba554f5abe97e3a76c615fba602e 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -76,6 +76,7 @@ extern int cmd_mktree(int argc, const char **argv, const char *prefix);
 extern int cmd_mv(int argc, const char **argv, const char *prefix);
 extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
 extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
+extern int cmd_patch_id(int argc, const char **argv, const char *prefix);
 extern int cmd_pickaxe(int argc, const char **argv, const char *prefix);
 extern int cmd_prune(int argc, const char **argv, const char *prefix);
 extern int cmd_prune_packed(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index cf7dd5d26cf27b38da94ed32dc521357db34369e..b60999ca9ebdb3582ed8cc790e0722a450bb2e40 100644 (file)
--- a/git.c
+++ b/git.c
@@ -341,6 +341,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
                { "name-rev", cmd_name_rev, RUN_SETUP },
                { "pack-objects", cmd_pack_objects, RUN_SETUP },
+               { "patch-id", cmd_patch_id },
                { "peek-remote", cmd_ls_remote },
                { "pickaxe", cmd_blame, RUN_SETUP },
                { "prune", cmd_prune, RUN_SETUP },