summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eriksen <s022018@student.dtu.dk>2006-05-23 12:15:30 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-05-23 20:11:12 (GMT)
commitaae01bda7f6d3224cf6b2ce0aa9aa668ce35d0b7 (patch)
treec9e9dd51d9d3f4f9259b09f6a85fc2a23c6339b6
parent0864f26421b3c599b462bc867de948d14b268d76 (diff)
downloadgit-aae01bda7f6d3224cf6b2ce0aa9aa668ce35d0b7.zip
git-aae01bda7f6d3224cf6b2ce0aa9aa668ce35d0b7.tar.gz
git-aae01bda7f6d3224cf6b2ce0aa9aa668ce35d0b7.tar.bz2
Builtin git-ls-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--Makefile6
-rw-r--r--builtin-ls-tree.c (renamed from ls-tree.c)5
-rw-r--r--builtin.h1
-rw-r--r--git.c3
4 files changed, 9 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index c540d7d..2afd089 100644
--- a/Makefile
+++ b/Makefile
@@ -155,7 +155,7 @@ PROGRAMS = \
git-diff-index$X git-diff-stages$X \
git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
git-hash-object$X git-index-pack$X git-local-fetch$X \
- git-ls-tree$X git-mailinfo$X git-merge-base$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 \
git-peek-remote$X git-prune-packed$X git-read-tree$X \
git-receive-pack$X git-rev-parse$X \
@@ -171,7 +171,7 @@ PROGRAMS = \
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-init-db$X git-ls-files$X git-ls-tree$X
# what 'all' will build and 'install' will install, in gitexecdir
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -220,7 +220,7 @@ LIB_OBJS = \
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-init-db.o builtin-ls-files.o builtin-ls-tree.o
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
LIBS = $(GITLIBS) -lz
diff --git a/ls-tree.c b/builtin-ls-tree.c
index f2b3bc1..48385d5 100644
--- a/ls-tree.c
+++ b/builtin-ls-tree.c
@@ -7,6 +7,7 @@
#include "blob.h"
#include "tree.h"
#include "quote.h"
+#include "builtin.h"
static int line_termination = '\n';
#define LS_RECURSIVE 1
@@ -15,7 +16,7 @@ static int line_termination = '\n';
#define LS_NAME_ONLY 8
static int abbrev = 0;
static int ls_options = 0;
-const char **pathspec;
+static const char **pathspec;
static int chomp_prefix = 0;
static const char *prefix;
@@ -84,7 +85,7 @@ static int show_tree(unsigned char *sha1, const char *base, int baselen,
return retval;
}
-int main(int argc, const char **argv)
+int cmd_ls_tree(int argc, const char **argv, char **envp)
{
unsigned char sha1[20];
struct tree *tree;
diff --git a/builtin.h b/builtin.h
index a0713d3..951f206 100644
--- a/builtin.h
+++ b/builtin.h
@@ -28,5 +28,6 @@ extern int cmd_rev_list(int argc, const char **argv, char **envp);
extern int cmd_check_ref_format(int argc, const char **argv, char **envp);
extern int cmd_init_db(int argc, const char **argv, char **envp);
extern int cmd_ls_files(int argc, const char **argv, char **envp);
+extern int cmd_ls_tree(int argc, const char **argv, char **envp);
#endif
diff --git a/git.c b/git.c
index 9cfa9eb..8574775 100644
--- a/git.c
+++ b/git.c
@@ -53,7 +53,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "rev-list", cmd_rev_list },
{ "init-db", cmd_init_db },
{ "check-ref-format", cmd_check_ref_format },
- { "ls-files", cmd_ls_files }
+ { "ls-files", cmd_ls_files },
+ { "ls-tree", cmd_ls_tree }
};
int i;