gitattributes filter: add new %r that expands to repository root

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

 



Dear Git Maintainers,

When building content filters with gitattributes, for instance to ensure
git stores the plain-text rather than the binary form of data in certain
formats, it is often advantageous to separate the filters into separate
scripts.  However, as the $PWD where content filters are executed is
unspecified (at least, unspecified in the git documentation I could find),
so the path to scripts needs to be specified as an absolute path.  That
means that the guide for setting up a repository which uses scripts to
filter content cannot simply consist of "copy-paste the following lines to
your .git/config file", and it means that the otherwise safe operation of
moving a git repository from one folder to another is decidedly unsafe.

To fix this, I propose the addition of a "%r" sequence, similar to the
existing "%f", which expands to the repository root (as opposed to the
path of the file undergoing filtering).  This would enable calls to
content filter scripts to be (for instance) stored in a root /scripts
folder, and the git-config value to be "sh %r/scripts/erase-all-secret-
plots".  If backwards compatibility is a serious concern, the sequence
could only be expanded if it occurs at the beginning of the first two
words.

I believe that would be simple to implement, and would be willing to do so
myself, but wanted to get your views first.  

Another useful addition, but one that would be less simple to implement
would be the creation of a way for a set of default keys to be added to
all repositories that clone from a certain remote.  This could take the
form of a .gitconfig-defaultkeys file in the root of the repository, which
is appended to .git/config on clone, if there are core structural reasons
that prevent a configuration file (even one with a restricted set of
permitted keys) from being included in the tracked repository itself.

This is my first message to the git mailing list, so apologies if I
did/said something wrong/stupid/obvious! Please give me feedback.

Thank you,
Calum McConnell

Attachment: signature.asc
Description: This is a digitally signed message part


[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]

  Powered by Linux