@matheusbsbs / matheus-bagliano / commits / e8cc9cd98e
Fork 0

Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>

Peter Eriksen committed May 23, 2006 at 14:15 UTC e8cc9cd98e2ecd7fd8bb03e725d470405c8e2b94
7 files changed +24 -11
Makefile
+6 -6
@@ -151,9 +151,7 @@ SIMPLE_PROGRAMS = \
151 PROGRAMS = \
152 git-cat-file$X \
153 git-checkout-index$X git-clone-pack$X \
154 - git-convert-objects$X git-diff-files$X \
155 - git-diff-index$X git-diff-stages$X \
156 - git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
154 + git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
155 git-hash-object$X git-index-pack$X git-local-fetch$X \
156 git-mailinfo$X git-merge-base$X \
157 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 \
171 git-grep$X git-rev-list$X git-check-ref-format$X \
172 git-init-db$X git-ls-files$X git-ls-tree$X \
173 git-tar-tree$X git-read-tree$X git-commit-tree$X \
176 - git-apply$X git-show-branch$X
174 + git-apply$X git-show-branch$X git-diff-files$X \
175 + git-diff-index$X git-diff-stages$X git-diff-tree$X
176
177 # what 'all' will build and 'install' will install, in gitexecdir
178 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -223,8 +222,9 @@ BUILTIN_OBJS = \
222 builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
223 builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \
224 builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o \
226 - builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \
227 - builtin-apply.o builtin-show-branch.o
225 + builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \
226 + builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
227 + builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o
228
229 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
230 LIBS = $(GITLIBS) -lz
builtin-diff-files.c renamed
+2 -1
@@ -7,12 +7,13 @@
7 #include "diff.h"
8 #include "commit.h"
9 #include "revision.h"
10 +#include "builtin.h"
11
12 static const char diff_files_usage[] =
13 "git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
14 COMMON_DIFF_OPTIONS_HELP;
15
15 -int main(int argc, const char **argv)
16 +int cmd_diff_files(int argc, const char **argv, char **envp)
17 {
18 struct rev_info rev;
19 int silent = 0;
builtin-diff-index.c renamed
+2 -1
@@ -2,13 +2,14 @@
2 #include "diff.h"
3 #include "commit.h"
4 #include "revision.h"
5 +#include "builtin.h"
6
7 static const char diff_cache_usage[] =
8 "git-diff-index [-m] [--cached] "
9 "[<common diff options>] <tree-ish> [<path>...]"
10 COMMON_DIFF_OPTIONS_HELP;
11
11 -int main(int argc, const char **argv)
12 +int cmd_diff_index(int argc, const char **argv, char **envp)
13 {
14 struct rev_info rev;
15 int cached = 0;
builtin-diff-stages.c renamed
+2 -1
@@ -4,6 +4,7 @@
4
5 #include "cache.h"
6 #include "diff.h"
7 +#include "builtin.h"
8
9 static struct diff_options diff_options;
10
@@ -54,7 +55,7 @@ static void diff_stages(int stage1, int stage2, const char **pathspec)
55 }
56 }
57
57 -int main(int ac, const char **av)
58 +int cmd_diff_stages(int ac, const char **av, char **envp)
59 {
60 int stage1, stage2;
61 const char *prefix = setup_git_directory();
builtin-diff-tree.c renamed
+2 -1
@@ -2,6 +2,7 @@
2 #include "diff.h"
3 #include "commit.h"
4 #include "log-tree.h"
5 +#include "builtin.h"
6
7 static struct rev_info log_tree_opt;
8
@@ -58,7 +59,7 @@ static const char diff_tree_usage[] =
59 " --root include the initial commit as diff against /dev/null\n"
60 COMMON_DIFF_OPTIONS_HELP;
61
61 -int main(int argc, const char **argv)
62 +int cmd_diff_tree(int argc, const char **argv, char **envp)
63 {
64 int nr_sha1;
65 char line[1000];
builtin.h
+5
@@ -34,5 +34,10 @@ extern int cmd_read_tree(int argc, const char **argv, char **envp);
34 extern int cmd_commit_tree(int argc, const char **argv, char **envp);
35 extern int cmd_apply(int argc, const char **argv, char **envp);
36 extern int cmd_show_branch(int argc, const char **argv, char **envp);
37 +extern int cmd_diff_files(int argc, const char **argv, char **envp);
38 +extern int cmd_diff_index(int argc, const char **argv, char **envp);
39 +extern int cmd_diff_stages(int argc, const char **argv, char **envp);
40 +extern int cmd_diff_tree(int argc, const char **argv, char **envp);
41 +
42
43 #endif
git.c
+5 -1
@@ -59,7 +59,11 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
59 { "read-tree", cmd_read_tree },
60 { "commit-tree", cmd_commit_tree },
61 { "apply", cmd_apply },
62 - { "show-branch", cmd_show_branch }
62 + { "show-branch", cmd_show_branch },
63 + { "diff-files", cmd_diff_files },
64 + { "diff-index", cmd_diff_index },
65 + { "diff-stages", cmd_diff_stages },
66 + { "diff-tree", cmd_diff_tree }
67 };
68 int i;
69