Builtin git-commit-tree.
authorPeter Eriksen <s022018@student.dtu.dk>
Tue, 23 May 2006 12:15:33 +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-commit-tree.c [moved from commit-tree.c with 96% similarity]
builtin.h
git.c

index 1aebcf59783aefc6ad92403b353133ed12206275..a1bee61e5738fb6903108e446c3d76a272fee07d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -150,7 +150,7 @@ SIMPLE_PROGRAMS = \
 # ... and all the rest that could be moved out of bindir to gitexecdir
 PROGRAMS = \
        git-apply$X git-cat-file$X \
-       git-checkout-index$X git-clone-pack$X git-commit-tree$X \
+       git-checkout-index$X git-clone-pack$X \
        git-convert-objects$X git-diff-files$X \
        git-diff-index$X git-diff-stages$X \
        git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
@@ -172,7 +172,7 @@ 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-tar-tree$X git-read-tree$X
+       git-tar-tree$X git-read-tree$X git-commit-tree$X
 
 # what 'all' will build and 'install' will install, in gitexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -222,7 +222,7 @@ 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-tar-tree.o builtin-read-tree.o
+        builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o
 
 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
 LIBS = $(GITLIBS) -lz
similarity index 96%
rename from commit-tree.c
rename to builtin-commit-tree.c
index 0320036e802f820760dd197f745698acb5531bbb..ec082bf754a0ce5ae1615c41ba32c4515a927361 100644 (file)
@@ -6,6 +6,7 @@
 #include "cache.h"
 #include "commit.h"
 #include "tree.h"
+#include "builtin.h"
 
 #define BLOCKING (1ul << 14)
 
@@ -76,7 +77,7 @@ static int new_parent(int idx)
        return 1;
 }
 
-int main(int argc, char **argv)
+int cmd_commit_tree(int argc, const char **argv, char **envp)
 {
        int i;
        int parents = 0;
@@ -98,7 +99,7 @@ int main(int argc, char **argv)
 
        check_valid(tree_sha1, tree_type);
        for (i = 2; i < argc; i += 2) {
-               char *a, *b;
+               const char *a, *b;
                a = argv[i]; b = argv[i+1];
                if (!b || strcmp(a, "-p"))
                        usage(commit_tree_usage);
index 88b3523c25a30c15b93f51ec84265a0441994547..c6b07d9a658418e833242aa5f0ac798d65d16ede 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -31,5 +31,6 @@ 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);
 extern int cmd_read_tree(int argc, const char **argv, char **envp);
+extern int cmd_commit_tree(int argc, const char **argv, char **envp);
 
 #endif
diff --git a/git.c b/git.c
index 300e2b269cb7fa823e211e76605c04b5aaa8375d..4c2c062e3648e4079038bff04fb98776d524af4f 100644 (file)
--- a/git.c
+++ b/git.c
@@ -56,7 +56,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
                { "ls-files", cmd_ls_files },
                { "ls-tree", cmd_ls_tree },
                { "tar-tree", cmd_tar_tree },
-               { "read-tree", cmd_read_tree }
+               { "read-tree", cmd_read_tree },
+               { "commit-tree", cmd_commit_tree }
        };
        int i;