Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

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

From: Roberto Eduardo Decurnex Gorosito <hidden>
Date: 2016-06-15 23:02:36

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.

Even the error message is clearly wrong.
    "unknown revision or path not in the working tree."

Example:

Given a repo at "~/path/to_repo" containing a file such as "README.md"
("~/path/to_repo/README.md")

~/path$ git --work-tree=~/path/to_repo log README.md
fatal: ambiguous argument 'README.md': unknown revision or path not in
the working tree.

As you can see here
(https://github.com/robertodecurnex/git/blob/master/setup.c#L147) git
is trying to `lstat` the path as it was given when it should validate
the file existence within the work tree (perpending the work-tree
before the file name).

Note: I now several workarounds for this, I'm not looking for a
solution to the specific problem but to discuss the implementation and
evaluate a change over the current behavior.

Regards,
--
Roberto Decurnex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help