3

JGit does not support .gitattributes. There is a 5 year old bug on that topic.

As a consequence, the ident macro isn't used by JGit ($Id expansion).

If you checkout a branch with regular console git, which supports .gitattributes and ident, the macro expansion happens. If you then do git blame, it doesn't see a difference in lines with the $Id$ macro. Which is expected.

If you then do jgit blame on that same repo, you get Not Committed Yet on lines that contain the $Id$ macro.

I found this out while investigating an issue with Sonarqube's Git plugin. The friendly people there opened a bug to followup.

My question: how do I tell regular git to ignore .gitattributes while doing a checkout? Extra brownie points: I need to do this in Jenkins, so preferably out of the box with some twiddling of the Jenkins Git plugin.

To be honest: I don't have high hopes for a positive answer. The best thing would be that JGit gets their act together and supports .gitattributes. But this is not the place for that rant.

Community
  • 1
  • 1
Amedee Van Gasse
  • 7,280
  • 5
  • 55
  • 101

1 Answers1

0

Maybe you could take benefit from JGit own bug and use it to do the checkout in Jenkins (in fact I was convinced Jenking Git plugin was already using JGit).

  • I cannot verify that right now. Due to a Groovy bug in Jenkins 2.6, I am unable to access the configuration page of the job that does the git checkout. – Amedee Van Gasse May 26 '16 at 11:48