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

Builtin git-ls-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 aae01bda7f6d3224cf6b2ce0aa9aa668ce35d0b7
4 files changed +9 -6
Makefile
+3 -3
@@ -155,7 +155,7 @@ PROGRAMS = \
155 git-diff-index$X git-diff-stages$X \
156 git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
157 git-hash-object$X git-index-pack$X git-local-fetch$X \
158 - git-ls-tree$X git-mailinfo$X git-merge-base$X \
158 + git-mailinfo$X git-merge-base$X \
159 git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \
160 git-peek-remote$X git-prune-packed$X git-read-tree$X \
161 git-receive-pack$X git-rev-parse$X \
@@ -171,7 +171,7 @@ PROGRAMS = \
171 BUILT_INS = git-log$X git-whatchanged$X git-show$X \
172 git-count-objects$X git-diff$X git-push$X \
173 git-grep$X git-rev-list$X git-check-ref-format$X \
174 - git-init-db$X git-ls-files$X
174 + git-init-db$X git-ls-files$X git-ls-tree$X
175
176 # what 'all' will build and 'install' will install, in gitexecdir
177 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -220,7 +220,7 @@ LIB_OBJS = \
220 BUILTIN_OBJS = \
221 builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
222 builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \
223 - builtin-init-db.o builtin-ls-files.o
223 + builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o
224
225 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
226 LIBS = $(GITLIBS) -lz
builtin-ls-tree.c renamed
+3 -2
@@ -7,6 +7,7 @@
7 #include "blob.h"
8 #include "tree.h"
9 #include "quote.h"
10 +#include "builtin.h"
11
12 static int line_termination = '\n';
13 #define LS_RECURSIVE 1
@@ -15,7 +16,7 @@ static int line_termination = '\n';
16 #define LS_NAME_ONLY 8
17 static int abbrev = 0;
18 static int ls_options = 0;
18 -const char **pathspec;
19 +static const char **pathspec;
20 static int chomp_prefix = 0;
21 static const char *prefix;
22
@@ -84,7 +85,7 @@ static int show_tree(unsigned char *sha1, const char *base, int baselen,
85 return retval;
86 }
87
87 -int main(int argc, const char **argv)
88 +int cmd_ls_tree(int argc, const char **argv, char **envp)
89 {
90 unsigned char sha1[20];
91 struct tree *tree;
builtin.h
+1
@@ -28,5 +28,6 @@ extern int cmd_rev_list(int argc, const char **argv, char **envp);
28 extern int cmd_check_ref_format(int argc, const char **argv, char **envp);
29 extern int cmd_init_db(int argc, const char **argv, char **envp);
30 extern int cmd_ls_files(int argc, const char **argv, char **envp);
31 +extern int cmd_ls_tree(int argc, const char **argv, char **envp);
32
33 #endif
git.c
+2 -1
@@ -53,7 +53,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
53 { "rev-list", cmd_rev_list },
54 { "init-db", cmd_init_db },
55 { "check-ref-format", cmd_check_ref_format },
56 - { "ls-files", cmd_ls_files }
56 + { "ls-files", cmd_ls_files },
57 + { "ls-tree", cmd_ls_tree }
58 };
59 int i;
60