Builtin git-tar-tree.
authorPeter Eriksen <s022018@student.dtu.dk>
Tue, 23 May 2006 12:15:31 +0000 (14:15 +0200)
committerJunio C Hamano <junkio@cox.net>
Tue, 23 May 2006 20:11:12 +0000 (13:11 -0700)
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Makefile
builtin-tar-tree.c [moved from tar-tree.c with 99% similarity]
builtin.h
git.c

index 2afd089a0d86d1e74c19ce6615fe9c6ff2a39092..a3164f8ef0444173ff16bcd951200664634aff0b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -161,7 +161,7 @@ PROGRAMS = \
        git-receive-pack$X git-rev-parse$X \
        git-send-pack$X git-show-branch$X git-shell$X \
        git-show-index$X git-ssh-fetch$X \
-       git-ssh-upload$X git-tar-tree$X git-unpack-file$X \
+       git-ssh-upload$X git-unpack-file$X \
        git-unpack-objects$X git-update-index$X git-update-server-info$X \
        git-upload-pack$X git-verify-pack$X git-write-tree$X \
        git-update-ref$X git-symbolic-ref$X \
@@ -171,7 +171,8 @@ PROGRAMS = \
 BUILT_INS = git-log$X git-whatchanged$X git-show$X \
        git-count-objects$X git-diff$X git-push$X \
        git-grep$X git-rev-list$X git-check-ref-format$X \
-       git-init-db$X git-ls-files$X git-ls-tree$X
+       git-init-db$X git-ls-files$X git-ls-tree$X \
+       git-tar-tree$X
 
 # what 'all' will build and 'install' will install, in gitexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -220,7 +221,8 @@ LIB_OBJS = \
 BUILTIN_OBJS = \
        builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
        builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \
-       builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o
+       builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o \
+        builtin-tar-tree.o
 
 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
 LIBS = $(GITLIBS) -lz
similarity index 99%
rename from tar-tree.c
rename to builtin-tar-tree.c
index 33087366c350655fe92837ba0fe0b3ac80865f33..6ada04ce3846ec9e973d79cd97e99b9fe84f17db 100644 (file)
@@ -7,6 +7,7 @@
 #include "commit.h"
 #include "strbuf.h"
 #include "tar.h"
+#include "builtin.h"
 
 #define RECORDSIZE     (512)
 #define BLOCKSIZE      (RECORDSIZE * 20)
@@ -301,7 +302,7 @@ static void traverse_tree(struct tree_desc *tree, struct strbuf *path)
        }
 }
 
-int main(int argc, char **argv)
+int cmd_tar_tree(int argc, const char **argv, char** envp)
 {
        unsigned char sha1[20], tree_sha1[20];
        struct commit *commit;
index 951f2063722b99c35c2052c1286fcad2f4dba54f..d2105439482d51c166352e48c08bca21ee1a5490 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -29,5 +29,6 @@ extern int cmd_check_ref_format(int argc, const char **argv, char **envp);
 extern int cmd_init_db(int argc, const char **argv, char **envp);
 extern int cmd_ls_files(int argc, const char **argv, char **envp);
 extern int cmd_ls_tree(int argc, const char **argv, char **envp);
+extern int cmd_tar_tree(int argc, const char **argv, char **envp);
 
 #endif
diff --git a/git.c b/git.c
index 8574775418954b9875a93dd50e84f108762d9a4e..c253e609532cbf115bf06ed53aec0d138650f001 100644 (file)
--- a/git.c
+++ b/git.c
@@ -54,7 +54,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
                { "init-db", cmd_init_db },
                { "check-ref-format", cmd_check_ref_format },
                { "ls-files", cmd_ls_files },
-               { "ls-tree", cmd_ls_tree }
+               { "ls-tree", cmd_ls_tree },
+               { "tar-tree", cmd_tar_tree }
        };
        int i;