git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git ls-files -X option is relative to repo root
@ 2015-02-13 19:23 Daniel Finnie
  2015-02-13 20:42 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Finnie @ 2015-02-13 19:23 UTC (permalink / raw)
  To: git

I encountered some unexpected behavior with Git today and was hoping
to either a) clear up my misconception or b) make a bug report.

My question deals with the --exclude-from option to git-ls-files.  It
appears that paths passed to this option are relative to the root of
the repository, not your current working directory.  I would have
expected the opposite, that the paths are relative to the working
directory.  I would expect to put a colon at the beginning of the path
to make it relative to the repository root.  Here's an example:

$ tree -a -I .git
.
├── .gitignore
└── example_dir
    ├── .gitignore
    └── example_file

# (all of these files are checked in, including example_file which is
also in .gitignore)

$ cat .gitignore
# empty gitignore

$ cat example_dir/.gitignore
example_file

$ (cd example_dir && git ls-files --ignore --exclude-from=.gitignore)
# No output because this references the git ignore at the project
root, not example_dir.  I expected this to output "example_file".

$ (cd example_dir && git ls-files --ignore
--exclude-from=example_dir/.gitignore)
example_file # works for the reason above, but I expected this to
break because example_dir/example_dir/.gitignore is not a file

So, what do you think?  Am I missing a git/*nix convention explaining
options would be specified relative to the repository root?  Or is
this a git bug?

Thanks for your time,
Dan Finnie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-13 22:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-13 19:23 git ls-files -X option is relative to repo root Daniel Finnie
2015-02-13 20:42 ` Junio C Hamano
2015-02-13 20:54   ` Junio C Hamano
2015-02-13 21:19     ` Daniel Finnie
2015-02-13 22:02       ` Junio C Hamano

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).