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

index 69377e37b4f82569f9c8116e4143251cf9c220e8..fc5f98b908d1485315c82341f697a4ef8af9dad5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -151,9 +151,7 @@ SIMPLE_PROGRAMS = \
 PROGRAMS = \
        git-cat-file$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 \
+       git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
        git-hash-object$X git-index-pack$X git-local-fetch$X \
        git-mailinfo$X git-merge-base$X \
        git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \
@@ -173,7 +171,8 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$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-commit-tree$X \
-       git-apply$X git-show-branch$X
+       git-apply$X git-show-branch$X git-diff-files$X \
+       git-diff-index$X git-diff-stages$X git-diff-tree$X
 
 # what 'all' will build and 'install' will install, in gitexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -223,8 +222,9 @@ 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-commit-tree.o \
-       builtin-apply.o builtin-show-branch.o
+       builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \
+       builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
+       builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o
 
 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
 LIBS = $(GITLIBS) -lz
similarity index 94%
rename from diff-files.c
rename to builtin-diff-files.c
index b9d193d506d9e67eb5f0c24905aa6d691ccff301..cebda828eec4e90f3d0af050e07a53071b39d5b7 100644 (file)
@@ -7,12 +7,13 @@
 #include "diff.h"
 #include "commit.h"
 #include "revision.h"
+#include "builtin.h"
 
 static const char diff_files_usage[] =
 "git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
 COMMON_DIFF_OPTIONS_HELP;
 
-int main(int argc, const char **argv)
+int cmd_diff_files(int argc, const char **argv, char **envp)
 {
        struct rev_info rev;
        int silent = 0;
similarity index 91%
rename from diff-index.c
rename to builtin-diff-index.c
index 8c9f60173b18a68f6ea224b2e6fc9c0eab4b9d0f..1958580d82e54ab5a5b1e054263eab7264c4bcb2 100644 (file)
@@ -2,13 +2,14 @@
 #include "diff.h"
 #include "commit.h"
 #include "revision.h"
+#include "builtin.h"
 
 static const char diff_cache_usage[] =
 "git-diff-index [-m] [--cached] "
 "[<common diff options>] <tree-ish> [<path>...]"
 COMMON_DIFF_OPTIONS_HELP;
 
-int main(int argc, const char **argv)
+int cmd_diff_index(int argc, const char **argv, char **envp)
 {
        struct rev_info rev;
        int cached = 0;
similarity index 96%
rename from diff-stages.c
rename to builtin-diff-stages.c
index dcd20e79e4fb67cdf6ed577a42277ad00b087c68..7c157ca889eaf85b38be2764fca83814bb83a3f4 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "cache.h"
 #include "diff.h"
+#include "builtin.h"
 
 static struct diff_options diff_options;
 
@@ -54,7 +55,7 @@ static void diff_stages(int stage1, int stage2, const char **pathspec)
        }
 }
 
-int main(int ac, const char **av)
+int cmd_diff_stages(int ac, const char **av, char **envp)
 {
        int stage1, stage2;
        const char *prefix = setup_git_directory();
similarity index 97%
rename from diff-tree.c
rename to builtin-diff-tree.c
index 69bb74b3100d598c938fa01f1111deb85abcfac0..cc53b81ac427f27522130e741350b955f4b1f653 100644 (file)
@@ -2,6 +2,7 @@
 #include "diff.h"
 #include "commit.h"
 #include "log-tree.h"
+#include "builtin.h"
 
 static struct rev_info log_tree_opt;
 
@@ -58,7 +59,7 @@ static const char diff_tree_usage[] =
 "  --root        include the initial commit as diff against /dev/null\n"
 COMMON_DIFF_OPTIONS_HELP;
 
-int main(int argc, const char **argv)
+int cmd_diff_tree(int argc, const char **argv, char **envp)
 {
        int nr_sha1;
        char line[1000];
index 01882ec93dfba0bbbb8e726858c0f4235380559d..7620984624abee4be236a38b31cfb7af966519f9 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -34,5 +34,10 @@ extern int cmd_read_tree(int argc, const char **argv, char **envp);
 extern int cmd_commit_tree(int argc, const char **argv, char **envp);
 extern int cmd_apply(int argc, const char **argv, char **envp);
 extern int cmd_show_branch(int argc, const char **argv, char **envp);
+extern int cmd_diff_files(int argc, const char **argv, char **envp);
+extern int cmd_diff_index(int argc, const char **argv, char **envp);
+extern int cmd_diff_stages(int argc, const char **argv, char **envp);
+extern int cmd_diff_tree(int argc, const char **argv, char **envp);
+
 
 #endif
diff --git a/git.c b/git.c
index d29505c4c92f56f1d9829e53d56b8ed7b915d587..874974874bf4fe2202587ff396816f5ae5f59247 100644 (file)
--- a/git.c
+++ b/git.c
@@ -59,7 +59,11 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
                { "read-tree", cmd_read_tree },
                { "commit-tree", cmd_commit_tree },
                { "apply", cmd_apply },
-               { "show-branch", cmd_show_branch }
+               { "show-branch", cmd_show_branch },
+               { "diff-files", cmd_diff_files },
+               { "diff-index", cmd_diff_index },
+               { "diff-stages", cmd_diff_stages },
+               { "diff-tree", cmd_diff_tree }
        };
        int i;