@matheusbsbs / matheus-bagliano / commits / 2e3ed670eb
Fork 0

git-verify-pack: make builtin

Convert git-verify-pack to a builtin command. Also rename ac to argc and av to argv for consistancy. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>

Rene Scharfe committed Aug 10, 2006 at 17:02 UTC 2e3ed670eb09feffe847af55db38da3dcecc2a88
4 files changed +11 -7
Makefile
+1
@@ -275,6 +275,7 @@ BUILTIN_OBJS = \
275 builtin-update-index.o \
276 builtin-update-ref.o \
277 builtin-upload-tar.o \
278 + builtin-verify-pack.o \
279 builtin-write-tree.o
280
281 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
builtin-verify-pack.c renamed
+8 -7
@@ -1,3 +1,4 @@
1 +#include "builtin.h"
2 #include "cache.h"
3 #include "pack.h"
4
@@ -47,28 +48,28 @@ static int verify_one_pack(const char *path, int verbose)
48
49 static const char verify_pack_usage[] = "git-verify-pack [-v] <pack>...";
50
50 -int main(int ac, char **av)
51 +int cmd_verify_pack(int argc, const char **argv, const char *prefix)
52 {
53 int err = 0;
54 int verbose = 0;
55 int no_more_options = 0;
56 int nothing_done = 1;
57
57 - while (1 < ac) {
58 - if (!no_more_options && av[1][0] == '-') {
59 - if (!strcmp("-v", av[1]))
58 + while (1 < argc) {
59 + if (!no_more_options && argv[1][0] == '-') {
60 + if (!strcmp("-v", argv[1]))
61 verbose = 1;
61 - else if (!strcmp("--", av[1]))
62 + else if (!strcmp("--", argv[1]))
63 no_more_options = 1;
64 else
65 usage(verify_pack_usage);
66 }
67 else {
67 - if (verify_one_pack(av[1], verbose))
68 + if (verify_one_pack(argv[1], verbose))
69 err = 1;
70 nothing_done = 0;
71 }
71 - ac--; av++;
72 + argc--; argv++;
73 }
74
75 if (nothing_done)
builtin.h
+1
@@ -59,5 +59,6 @@ extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
59 extern int cmd_version(int argc, const char **argv, const char *prefix);
60 extern int cmd_whatchanged(int argc, const char **argv, const char *prefix);
61 extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
62 +extern int cmd_verify_pack(int argc, const char **argv, const char *prefix);
63
64 #endif
git.c
+1
@@ -270,6 +270,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
270 { "version", cmd_version },
271 { "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
272 { "write-tree", cmd_write_tree, RUN_SETUP },
273 + { "verify-pack", cmd_verify_pack },
274 };
275 int i;
276