Make git-prune-packed a builtin
authorMatthias Kestenholz <matthias@spinlock.ch>
Wed, 2 Aug 2006 16:32:32 +0000 (18:32 +0200)
committerJunio C Hamano <junkio@cox.net>
Wed, 2 Aug 2006 18:36:01 +0000 (11:36 -0700)
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Makefile
builtin-prune-packed.c [moved from prune-packed.c with 95% similarity]
builtin.h
git.c

index e66e9b16a523223f135d7c57baa1339b8112efe9..fd45cd19b134a8a1c104d110be4bab985c048f0a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -178,7 +178,7 @@ PROGRAMS = \
        git-hash-object$X git-index-pack$X git-local-fetch$X \
        git-merge-base$X \
        git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \
-       git-peek-remote$X git-prune-packed$X git-receive-pack$X \
+       git-peek-remote$X git-receive-pack$X \
        git-send-pack$X git-shell$X \
        git-show-index$X git-ssh-fetch$X \
        git-ssh-upload$X git-unpack-file$X \
@@ -197,7 +197,7 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X git-update-ref$X \
        git-read-tree$X git-commit-tree$X git-write-tree$X \
        git-apply$X git-show-branch$X git-diff-files$X git-update-index$X \
        git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
-       git-fmt-merge-msg$X git-prune$X git-mv$X
+       git-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X
 
 # what 'all' will build and 'install' will install, in gitexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -254,7 +254,7 @@ BUILTIN_OBJS = \
        builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
        builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
        builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
-       builtin-mv.o
+       builtin-mv.o builtin-prune-packed.o
 
 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
 LIBS = $(GITLIBS) -lz
similarity index 95%
rename from prune-packed.c
rename to builtin-prune-packed.c
index d24b097114ef2610416b106ea9aa2000873924f3..d0ff336c1479a772f9658ccc52d561469116707d 100644 (file)
@@ -54,12 +54,10 @@ static void prune_packed_objects(void)
        }
 }
 
-int main(int argc, char **argv)
+int cmd_prune_packed(int argc, char **argv, const char *prefix)
 {
        int i;
 
-       setup_git_directory();
-
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
 
index f10d3b77c87ea5e542a9ff150051baa72fb47a40..7ddfe2891cfa7104d59960c3b1427b742716dc7d 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -20,6 +20,7 @@ extern int cmd_format_patch(int argc, const char **argv, const char *prefix);
 extern int cmd_count_objects(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);
 
 extern int cmd_push(int argc, const char **argv, const char *prefix);
 extern int cmd_grep(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 110e82e9ac52bb0972f25efd5e84a229a72b03d5..5b50762de179607df488feb2becd531ee3d3fea6 100644 (file)
--- a/git.c
+++ b/git.c
@@ -263,6 +263,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
                { "fmt-merge-msg", cmd_fmt_merge_msg, NEEDS_PREFIX },
                { "prune", cmd_prune, NEEDS_PREFIX },
                { "mv", cmd_mv, NEEDS_PREFIX },
+               { "prune-packed", cmd_prune_packed, NEEDS_PREFIX },
        };
        int i;