git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/8] Builtin git-ls-tree.

From
PEPeter Eriksen <s022018@student.dtu.dk>
Date
May 23, 2006, 12:15 UTC
Message-ID
<44992.4130844467$1148386590@news.gmane.org>
In-Reply-To
<11483865361243-git-send-email-1>
From: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
---
419257801e5bc91fc435bd4ff9eb42aa8063ffbb
 Makefile                       |    6 +++---
 ls-tree.c => builtin-ls-tree.c |    3 ++-
 builtin.h                      |    1 +
 git.c                          |    3 ++-
 4 files changed, 8 insertions(+), 5 deletions(-)
 rename ls-tree.c => builtin-ls-tree.c (98%)
419257801e5bc91fc435bd4ff9eb42aa8063ffbb
diff --git a/Makefile b/Makefile
index e522730..9b02264 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
similarity index 98%
rename from ls-tree.c
rename to builtin-ls-tree.c
index f2b3bc1..b515307 100644
--- a/ls-tree.c
+++ b/builtin-ls-tree.c
@@ -7,6 +7,7 @@ #include "cache.h"
 #include "blob.h"
 #include "tree.h"
 #include "quote.h"
+#include "builtin.h"
 
 static int line_termination = '\n';
 #define LS_RECURSIVE 1
@@ -84,7 +85,7 @@ static int show_tree(unsigned char *sha1
 	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 
 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 
 		{ "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;
 
-- 
1.3.3.g288c
Previous: Peter EriksenNext: Peter Eriksen
Message 2 of 13 in “Builtin git-ls-files.”
  1. 1/8 Builtin git-ls-files.Peter Eriksen, May 23, 2006
  2. 2/8 Builtin git-ls-tree.Peter Eriksen, May 23, 2006
  3. 3/8 Builtin git-tar-tree.Peter Eriksen, May 23, 2006
  4. 4/8 Builtin git-read-tree.Peter Eriksen, May 23, 2006
  5. 5/8 Builtin git-commit-tree.Peter Eriksen, May 23, 2006
  6. 6/8 Builtin git-apply.Peter Eriksen, May 23, 2006
  7. 7/8 Builtin git-show-branch.Peter Eriksen, May 23, 2006
  8. 8/8 Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.Peter Eriksen, May 23, 2006
  9. Peter EriksenMay 23, 2006
  10. Jakub NarebskiMay 23, 2006
  11. Peter EriksenMay 23, 2006
  12. Jakub NarebskiMay 23, 2006
  13. Ryan AndersonMay 23, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.