git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: "Steve Frécinaux" <code@istique.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add a notice to the doc of git-ls-tree.
Date: Mon, 21 Jul 2008 01:08:46 +0200	[thread overview]
Message-ID: <20080720230846.GH32184@machine.or.cz> (raw)
In-Reply-To: <1216592735-23789-1-git-send-email-code@istique.net>

On Mon, Jul 21, 2008 at 12:25:35AM +0200, Steve Frécinaux wrote:
> The notice covers this behaviour:
> if you are in the git/ subdirectory of your repository, it will pick
> the tree corresponding to that directory instead of the root one if you
> specify the root tree object id.
> 
> Compare the output of both of those commands:
>  git-ls-tree cb44e6571708aa2792c73a289d87586fe3c0c362
>  git-cat-file -p cb44e6571708aa2792c73a289d87586fe3c0c362
> ---
>  Documentation/git-ls-tree.txt |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt
> index 1cdec22..7cba394 100644
> --- a/Documentation/git-ls-tree.txt
> +++ b/Documentation/git-ls-tree.txt
> @@ -21,6 +21,10 @@ though - 'paths' denote just a list of patterns to match, e.g. so specifying
>  directory name (without '-r') will behave differently, and order of the
>  arguments does not matter.
>  
> +Note that if you give ls-tree the sha1 id of a parent of the tree
> +corresponding to the directory you're in, it will resolve that tree and list
> +its contents instead of listing the contents of the tree you gave.
> +
>  OPTIONS
>  -------
>  <tree-ish>::

It's hard to make out what do you mean, the patch description is much
clearer, paradoxically. Also, this in fact holds for the root tree
instead of the parent tree, and the behaviour changes from "weird" to
"simply broken" when you try to list a tree object that is _not_ the
root project tree from within a subdirectory:

	git$ git ls-tree HEAD Documentation
	040000 tree 066c25e86a44d4c7bde2d3e9b91e6891d752efa1    Documentation
	git/Documentation$ git ls-tree 066c25e86a44d4c7bde2d3e9b91e6891d752efa1
	git/Documentation$

I think that ls-tree simply shouldn't auto-fill its pathspec based on
current prefix in case no pathspec was supplied. Patch to follow.

-- 
				Petr "Pasky" Baudis
As in certain cults it is possible to kill a process if you know
its true name.  -- Ken Thompson and Dennis M. Ritchie

  reply	other threads:[~2008-07-20 23:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-20 22:25 [PATCH] Add a notice to the doc of git-ls-tree Steve Frécinaux
2008-07-20 23:08 ` Petr Baudis [this message]
2008-07-20 23:22   ` Steve Frécinaux
2008-07-20 23:24   ` Junio C Hamano
2008-07-20 23:39     ` Petr Baudis
2008-07-21  7:56       ` [PATCH] Documentation/git-ls-tree.txt: Add a caveat about prefixing pathspec Petr Baudis
2008-07-21  8:00         ` Junio C Hamano
2008-07-21 21:04           ` Petr Baudis
2008-07-22  0:32             ` Junio C Hamano
2008-07-22 22:47               ` Petr Baudis
2008-07-28  0:46                 ` Petr Baudis
2008-07-28  1:26                   ` Junio C Hamano
2008-07-28  9:23                     ` Junio C Hamano
2008-07-21  8:45         ` Steve Frécinaux
2008-07-20 23:53     ` [PATCH] Add a notice to the doc of git-ls-tree Junio C Hamano
2008-07-21  0:08       ` Petr Baudis
2008-07-21  0:14         ` Junio C Hamano
2008-07-21  0:22           ` Petr Baudis
2008-07-21  4:28             ` Junio C Hamano
2008-07-21  7:47               ` Petr Baudis

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=20080720230846.GH32184@machine.or.cz \
    --to=pasky@suse.cz \
    --cc=code@istique.net \
    --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.
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).