From: Lars Hjemli <hjemli@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [RFC/PATCH 3/3] builtin-ls-tree: enable traversal of submodules
Date: Mon, 12 Jan 2009 00:45:55 +0100 [thread overview]
Message-ID: <1231717555-10559-4-git-send-email-hjemli@gmail.com> (raw)
In-Reply-To: <1231717555-10559-3-git-send-email-hjemli@gmail.com>
The option '--submodules', which implies '-r', activates the traversal
of all submodules for which the linked commit is reachable.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
builtin-ls-tree.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index cb61717..8a1db54 100644
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
@@ -23,7 +23,7 @@ static int chomp_prefix;
static const char *ls_tree_prefix;
static const char ls_tree_usage[] =
- "git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]";
+ "git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] [--submodules] <tree-ish> [path...]";
static int show_recursive(const char *base, int baselen, const char *pathname)
{
@@ -63,20 +63,8 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
unsigned long size;
if (S_ISGITLINK(mode)) {
- /*
- * Maybe we want to have some recursive version here?
- *
- * Something similar to this incomplete example:
- *
- if (show_subprojects(base, baselen, pathname)) {
- struct child_process ls_tree;
-
- ls_tree.dir = base;
- ls_tree.argv = ls-tree;
- start_command(&ls_tree);
- }
- *
- */
+ if (show_recursive(base, baselen, pathname))
+ retval = READ_TREE_RECURSIVE;
type = commit_type;
} else if (S_ISDIR(mode)) {
if (show_recursive(base, baselen, pathname)) {
@@ -168,6 +156,11 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
abbrev = DEFAULT_ABBREV;
break;
}
+ if (!strcmp(argv[1]+2, "submodules")) {
+ ls_options |= LS_RECURSIVE;
+ traverse_gitlinks = 1;
+ break;
+ }
/* otherwise fallthru */
default:
usage(ls_tree_usage);
--
1.6.1.81.g1df1.dirty
next prev parent reply other threads:[~2009-01-12 0:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-11 23:45 [RFC/PATCH 0/3] Enable in-process submodule traversal Lars Hjemli
2009-01-11 23:45 ` [RFC/PATCH 1/3] tree.c: add support for traversal of submodules Lars Hjemli
2009-01-11 23:45 ` [RFC/PATCH 2/3] archive.c: enable " Lars Hjemli
2009-01-11 23:45 ` Lars Hjemli [this message]
2009-01-12 3:15 ` [RFC/PATCH 1/3] tree.c: add support for " Junio C Hamano
2009-01-12 9:04 ` Lars Hjemli
2009-01-12 10:07 ` Junio C Hamano
2009-01-12 10:59 ` Lars Hjemli
2009-01-12 2:07 ` [RFC/PATCH 0/3] Enable in-process submodule traversal Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1231717555-10559-4-git-send-email-hjemli@gmail.com \
--to=hjemli@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).