git diff --check in a bare repository

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

 



Hello

I am using "git diff --check" on the "server-side" (i.e. in a bare
repository as part of a git hook)
with a .gitattributes rule saying

*.md text whitespace=-trailing-space # notice the - in front of trailing

I can check that the attribute is set/read correctly thanks to another
thread on this mailing list

$ export GIT_INDEX_FILE=index.tmp
$ git read-tree --reset -i $SHA
$ git check-attr --cached foo.md # shows up whitespace: -trailing-space
$ rm index.tmp

but then when I run

$ git diff --check $SHA^..$SHA -- foo.md

then I get an error that foo.md contains a trailing space (as if the
.gitattributes in $SHA is ignored).

The reverse applies as well. Since trailing-space is enabled by
default, I edited ~/.gitconfig and set core.whitespace =
-trailing-space.

now "git diff --check" doesn't complain, but if I commit and push a
rule in .gitattributes saying

*.md text whitespace=trailing-space

then I do not get an error when pushing foo.md with trailing-space.

I experience the same behaviour in 1.9.1 and 2.6.1.
For what it's worth as input to the above issue, I have also tried

$ export GIT_INDEX_FILE=index.tmp
$ git read-tree --reset -i $SHA
$ git diff --check --cached -- foo.md

but the same behaviour can be noticed.

I am not subscribed to the mailing list, so please keep me in CC

Thank you in advance,
Andrei

--
andreineculau.com
--
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]