From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Deskin Miller <deskinm@umich.edu>
Subject: [PATCH] ls-tree: add --full-tree option
Date: Thu, 25 Dec 2008 16:54:23 -0800 [thread overview]
Message-ID: <7v63l7rc1s.fsf@gitster.siamese.dyndns.org> (raw)
The established behaviour of "git ls-tree $commit" run from a subdirectory
"sub/dir" in a work tree is to limit the output to the paths in the
subdirectory, and strip off the leading "sub/dir" from the output, since
3c5e846 (ls-tree: major rewrite to do pathspec, 2005-11-26).
This was a "usability" feature made back in the days when the line between
Porcelain and plumbing was blurry, and in retrospect, it probably was
misguided. The behaviour may be what the end user would expect when the
command is run interactively from a subdirectory, but it also means that a
scripted Porcelain that wants to use the command to list the full contents
of a tree object has to do cd_to_toplevel (and save the output from
"rev-parse --show-prefix" before doing so, so that it can be used as a
pathspec if it wants to limit its operation to the original subdirectory
in other commands).
This new option makes the command operate on the full tree object,
regardless of where in the work tree it is run from. It also implies the
behaviour that is triggered by the existing --full-name option.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* There was a discussion on #git between Ilari and deskin this morning;
hopefully I captured what they wanted correctly.
I do not care too deeply with this change myself, though...
builtin-ls-tree.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index cb61717..c386aa5 100644
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
@@ -156,6 +156,11 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
chomp_prefix = 0;
break;
}
+ if (!strcmp(argv[1]+2, "full-tree")) {
+ ls_tree_prefix = prefix = NULL;
+ chomp_prefix = 0;
+ break;
+ }
if (!prefixcmp(argv[1]+2, "abbrev=")) {
abbrev = strtoul(argv[1]+9, NULL, 10);
if (abbrev && abbrev < MINIMUM_ABBREV)
--
1.6.1
next reply other threads:[~2008-12-26 0:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-26 0:54 Junio C Hamano [this message]
2008-12-26 8:16 ` [PATCH] ls-tree: add --full-tree option Johannes Sixt
2008-12-26 8:55 ` Junio C Hamano
2008-12-26 10:31 ` demerphq
2008-12-26 19:49 ` Johannes Sixt
2008-12-26 21:38 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v63l7rc1s.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=deskinm@umich.edu \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).