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

Builtin git-cat-file

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Timo Hirvonen committed May 24, 2006 at 14:08 UTC f81daefe56b3c97b93a851e1ada14eeca0dea47a
4 files changed +8 -5
Makefile
+3 -3
@@ -149,7 +149,6 @@ SIMPLE_PROGRAMS = \
149
150 # ... and all the rest that could be moved out of bindir to gitexecdir
151 PROGRAMS = \
152 - git-cat-file$X \
152 git-checkout-index$X git-clone-pack$X \
153 git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
154 git-hash-object$X git-index-pack$X git-local-fetch$X \
@@ -174,7 +173,7 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X \
173 git-ls-files$X git-ls-tree$X \
174 git-read-tree$X git-commit-tree$X \
175 git-apply$X git-show-branch$X git-diff-files$X \
177 - git-diff-index$X git-diff-stages$X git-diff-tree$X
176 + git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X
177
178 # what 'all' will build and 'install' will install, in gitexecdir
179 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -228,7 +227,8 @@ BUILTIN_OBJS = \
227 builtin-ls-files.o builtin-ls-tree.o \
228 builtin-read-tree.o builtin-commit-tree.o \
229 builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
231 - builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o
230 + builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
231 + builtin-cat-file.o
232
233 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
234 LIBS = $(GITLIBS) -lz
builtin-cat-file.c renamed
+2 -1
@@ -7,6 +7,7 @@
7 #include "exec_cmd.h"
8 #include "tag.h"
9 #include "tree.h"
10 +#include "builtin.h"
11
12 static void flush_buffer(const char *buf, unsigned long size)
13 {
@@ -93,7 +94,7 @@ static int pprint_tag(const unsigned char *sha1, const char *buf, unsigned long
94 return 0;
95 }
96
96 -int main(int argc, char **argv)
97 +int cmd_cat_file(int argc, const char **argv, char **envp)
98 {
99 unsigned char sha1[20];
100 char type[20];
builtin.h
+1
@@ -42,5 +42,6 @@ extern int cmd_diff_files(int argc, const char **argv, char **envp);
42 extern int cmd_diff_index(int argc, const char **argv, char **envp);
43 extern int cmd_diff_stages(int argc, const char **argv, char **envp);
44 extern int cmd_diff_tree(int argc, const char **argv, char **envp);
45 +extern int cmd_cat_file(int argc, const char **argv, char **envp);
46
47 #endif
git.c
+2 -1
@@ -68,7 +68,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
68 { "diff-files", cmd_diff_files },
69 { "diff-index", cmd_diff_index },
70 { "diff-stages", cmd_diff_stages },
71 - { "diff-tree", cmd_diff_tree }
71 + { "diff-tree", cmd_diff_tree },
72 + { "cat-file", cmd_cat_file }
73 };
74 int i;
75