From: Daniel Finnie <dan@danfinnie.com>
To: git@vger.kernel.org
Subject: git ls-files -X option is relative to repo root
Date: Fri, 13 Feb 2015 14:23:40 -0500 [thread overview]
Message-ID: <CAG4vEKM-2sy0z3=YLS+rgH99w6ukdcNBode9CAh4C4t9eSa02A@mail.gmail.com> (raw)
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
next reply other threads:[~2015-02-13 19:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-13 19:23 Daniel Finnie [this message]
2015-02-13 20:42 ` git ls-files -X option is relative to repo root 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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAG4vEKM-2sy0z3=YLS+rgH99w6ukdcNBode9CAh4C4t9eSa02A@mail.gmail.com' \
--to=dan@danfinnie.com \
--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.
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).