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

Re: [BUG?] Path limiting in "git log" when run from another subdir

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Sep 24, 2012, 13:30 UTC
Message-ID
<CACsJy8A4-XC7AS4ZqZ1Whsoo-mztTNFvEnk810e10-rwXBkJHA@mail.gmail.com>
In-Reply-To
<CALKQrgfb8qbeKmCzri27iA1qk9H8R4FgyA-YsUQf_JQRWvGK4g@mail.gmail.com>
On Mon, Sep 24, 2012 at 8:16 PM, Johan Herland <johan@herland.net> wrote:
Show 18 quoted lines
> On Mon, Sep 24, 2012 at 2:22 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
>> On Mon, Sep 24, 2012 at 6:59 PM, Johan Herland <johan@herland.net> wrote:
>>> The following works in the git.git repo:
>>>
>>> $ cd t
>>> $ git log -- /Documentation
>>> [...]
>>>
>>
>> What version? Mine (recent master) does not work
>>
>> ~/w/git/t $ ../git log -- /Documentation
>> fatal: '/Documentation' is outside repository
>
> We initially found it on 1.7.9.5, and conrfirmed it on various 1.7.10
> versions. A bisect reveals that this behavior changed in
> v1.7.11.5-35-gf4c21e8 (Michael Haggerty: real_path(): properly handle
> nonexistent top-level paths).

OK checking. I still don't know why it does not happen to me. Any special in gitdir/worktree setting? That commit is in master.

> Does this mean that "git log -- /Documentation" never should have
> worked in the first place (and was "fixed" by this commit), or that it
> should work (but was broken by this commit)?

I think that should mean Documentation at root. "git log -- `chdir ../Documentation;pwd`" works and that clearly conflicts with interpreting "/Documentation" as the directory at worktree's root.

> In any case, what is the _preferred_ way to path-limit "git log" to
> Documentation/RelNotes, when my cwd is t/?

If you want worktree root no matter where you stand, use "git log -- :/Documentation/RelNotes". The idea is ":" starts some "magic" in path handling, but for now there is only ":/". Or if you don't like magic, `git rev-parse --git-dir` should give you worktree's root to start with.

-- 
Duy
Previous: Johan HerlandNext: Nguyen Thai Ngoc Duy
Message 4 of 7 in “[BUG?] Path limiting in "git log" when run from another subdir”
  1. Johan HerlandSep 24, 2012
  2. Nguyen Thai Ngoc DuySep 24, 2012
  3. Johan HerlandSep 24, 2012
  4. Nguyen Thai Ngoc DuySep 24, 2012
  5. Nguyen Thai Ngoc DuySep 24, 2012
  6. Johan HerlandSep 24, 2012
  7. Johan HerlandSep 24, 2012

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.