git ls-files -X option is relative to repo root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]