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

Re: `git log relative_path_to_object` does not respect the --work-tree path

From
Roberto Eduardo Decurnex Gorosito <decurnex.roberto@gmail.com>
Date
Sep 30, 2014, 12:42 UTC
Message-ID
<CABj5xzdXZRorQu=8CBiYFt058kVQVzfFXSYzXDYofFN06u4Hpw@mail.gmail.com>
In-Reply-To
<20140929205612.GQ1175@google.com>
Ok. Yes, it 's kind of tricky. But the `-- <path>` does both things.

`-- <path>` looks for the relative path within the current directory but defaults to the work-tree root if your current directory does not belong to the repo.

About `git -C <dir>`, awesome feature, I love that, but it's not my point. (and I'm actually maintaining the ruby-git gem, supporting git

>= 1.6 T_T)
I really appreciate your feedback.

Regards, -- Roberto Decurnex

On Mon, Sep 29, 2014 at 5:56 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 21 quoted lines
> Hi Roberto,
>
> Roberto Eduardo Decurnex Gorosito wrote:
>
>> When passing objects to the `git log`, by just naming them or using
>> the `--objects` option, relative paths are evaluated using the current
>> working directory instead of the current working tree path.
>
> Why should they be relative to the worktree root?  When you use
> relative paths within a worktree, they are not relative to the
> worktree root.  For example, the following works within a clone of
> git.git:
>
>         $ cd Documentation
>         $ git log git.txt
>
> You might be looking for 'git -C <directory>', which chdirs to the
> named directory so paths are relative to there.
>
> Hope that helps,
> Jonathan
Previous: Jonathan Nieder
Message 5 of 5 in “`git log relative_path_to_object` does not respect the --work-tree path”
  1. Roberto Eduardo Decurnex GorositoSep 29, 2014
  2. Junio C HamanoSep 29, 2014
  3. Roberto Eduardo Decurnex GorositoSep 29, 2014
  4. Jonathan NiederSep 29, 2014
  5. Roberto Eduardo Decurnex GorositoSep 30, 2014

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.