git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	David Barr <david.barr@cordelta.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH v3] fast-import: add 'ls' command
Date: Fri, 11 Feb 2011 16:59:04 -0600	[thread overview]
Message-ID: <20110211225904.GA22391@elie> (raw)
In-Reply-To: <AANLkTimReMYu7QYZEuunmH6WqUz=C0nOnAZHzB6cddXt@mail.gmail.com>

Sverre Rabbelier wrote:
> On Fri, Feb 11, 2011 at 23:43, Jonathan Nieder <jrnieder@gmail.com> wrote:

>> Introduce an "ls" command to read directory entries from the active
>> commit or a named commit.  This allows printing a blob from the active
>> commit or copying a blob or tree from a previous commit for use in the
>> current one.
>
> Useful addition I think. What happens if you ask it for a path that is
> not a directory?

Hmm, the documentation was not at all clear, then.  Good catch.

The answer is that it always prints a single dirent, whether the path
supplied names a file or a directory.

	FE> ls :1 Documentation
	gfi> 040000 tree 9e6c2b599341d28a2a375f8207507e0a2a627fe9	Documentation
	FE> ls :1 git.c
	gfi> 100644 blob 23610aa0366ebe36e65e78fb8c5fba3f2d0b8f77	git.c
	FE> ls :1 thisfiledoesnotexist
	gfi> 040000 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904	thisfiledoesnotexist
	FE> ls :1 RelNotes
	gfi> 120000 blob b942e499449d97aeb50c73ca2bdc1c6e6d528743	RelNotes
	FE> ls 9e6c2b599341d28a2a375f8207507e0a2a627fe9 git-fast-import.txt
	gfi> 100644 blob 4f92954396e3f0f97e75b6838a5635b583708870	git-fast-import.txt
	FE> cat-blob b942e499449d97aeb50c73ca2bdc1c6e6d528743
	gfi> b942e499449d97aeb50c73ca2bdc1c6e6d528743 blob 32
	gfi> Documentation/RelNotes/1.7.4.txt

Maybe this patch (for squashing) would help.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 4f92954..495e01f 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -336,9 +336,9 @@ and control the current import process.  More detailed discussion
 	`stdout` if unspecified.
 
 `ls`::
-	Causes fast-import to print a directory entry in 'ls-tree'
-	format to the file descriptor set with `--cat-blob-fd` or
-	`stdout` if unspecified.
+	Causes fast-import to print a line describing a directory
+	entry in 'ls-tree' format to the file descriptor set with
+	`--cat-blob-fd` or `stdout` if unspecified.
 
 `feature`::
 	Require that fast-import supports the specified feature, or
@@ -927,10 +927,11 @@ middle of a commit but not in the middle of a `data` command.
 
 `ls`
 ~~~~
-Prints a directory entry to a file descriptor previously arranged with
-the `--cat-blob-fd` argument.  This allows printing a blob from the
-active commit (with `cat-blob`) or copying a blob or tree from a
-previous commit for use in the current one (with `filemodify`).
+Prints information about the object at a path to a file descriptor
+previously arranged with the `--cat-blob-fd` argument.  This allows
+printing a blob from the active commit (with `cat-blob`) or copying a
+blob or tree from a previous commit for use in the current one (with
+`filemodify`).
 
 The `ls` command can be used anywhere in the stream that comments are
 accepted, including the middle of a commit.
@@ -957,7 +958,7 @@ Reading from a named tree::
 
 See `filemodify` above for a detailed description of `<path>`.
 
-Output uses the same format as `git ls-tree <tree> -- <path>`:
+Output uses the same format as `git ls-tree <tree> {litdd} <path>`:
 
 ====
 	<mode> SP ('blob' | 'tree' | 'commit') SP <dataref> HT <path> LF

  reply	other threads:[~2011-02-11 22:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 22:43 [PATCH v3] fast-import: add 'ls' command Jonathan Nieder
2011-02-11 22:47 ` Sverre Rabbelier
2011-02-11 22:59   ` Jonathan Nieder [this message]
2011-02-11 23:51     ` Sverre Rabbelier
2011-02-12  0:40 ` Junio C Hamano
2011-02-12  1:21   ` Jonathan Nieder
2011-02-12  1:36     ` Jonathan Nieder

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=20110211225904.GA22391@elie \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=srabbelier@gmail.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.
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).