{"action":"created","issue":{"url":"https://api.github.com/repos/palantir/gradle-git-version/issues/28","repository_url":"https://api.github.com/repos/palantir/gradle-git-version","labels_url":"https://api.github.com/repos/palantir/gradle-git-version/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/palantir/gradle-git-version/issues/28/comments","events_url":"https://api.github.com/repos/palantir/gradle-git-version/issues/28/events","html_url":"https://github.com/palantir/gradle-git-version/issues/28","id":144557361,"number":28,"title":"Incorrectly marking builds as dirty","user":{"login":"chrisalice","id":979369,"avatar_url":"https://avatars.githubusercontent.com/u/979369?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisalice","html_url":"https://github.com/chrisalice","followers_url":"https://api.github.com/users/chrisalice/followers","following_url":"https://api.github.com/users/chrisalice/following{/other_user}","gists_url":"https://api.github.com/users/chrisalice/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisalice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisalice/subscriptions","organizations_url":"https://api.github.com/users/chrisalice/orgs","repos_url":"https://api.github.com/users/chrisalice/repos","events_url":"https://api.github.com/users/chrisalice/events{/privacy}","received_events_url":"https://api.github.com/users/chrisalice/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-30T11:38:25Z","updated_at":"2016-03-30T11:52:41Z","closed_at":null,"body":"gradle-git-version is incorrectly marking my builds as dirty. After some experimentation, I discovered adding `git status` to circle.yml immediately before the broken build magically fixes it. I then ls-ed the entire workspace before and after `git status`, and discovered the `.git/index` file is being updated. According to https://www.kernel.org/pub/software/scm/git/docs/technical/racy-git.txt, the index file is maintained lazily, and git needs to verify the state of the world when determining the status. Presumably jgit is just a broken git implementation in this regard?"},"comment":{"url":"https://api.github.com/repos/palantir/gradle-git-version/issues/comments/203395502","html_url":"https://github.com/palantir/gradle-git-version/issues/28#issuecomment-203395502","issue_url":"https://api.github.com/repos/palantir/gradle-git-version/issues/28","id":203395502,"user":{"login":"markelliot","id":685891,"avatar_url":"https://avatars.githubusercontent.com/u/685891?v=3","gravatar_id":"","url":"https://api.github.com/users/markelliot","html_url":"https://github.com/markelliot","followers_url":"https://api.github.com/users/markelliot/followers","following_url":"https://api.github.com/users/markelliot/following{/other_user}","gists_url":"https://api.github.com/users/markelliot/gists{/gist_id}","starred_url":"https://api.github.com/users/markelliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markelliot/subscriptions","organizations_url":"https://api.github.com/users/markelliot/orgs","repos_url":"https://api.github.com/users/markelliot/repos","events_url":"https://api.github.com/users/markelliot/events{/privacy}","received_events_url":"https://api.github.com/users/markelliot/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T11:52:41Z","updated_at":"2016-03-30T11:52:41Z","body":"For improved debug, one thing we could do is add logging or another function that will return more details about what JGit status is using to decide what's dirty. \n\nIn particular, if you have a good repro of this, it'd be really helpful to print additional details to confirm its the index file using something like:\n\n    Git git = Git.wrap(new FileRepository(\".git\")\n    Status status = git.status().call()\n    println \"clean \" + status.isClean()\n    println \"added \" + status.getAdded()\n    println \"changed \" + status.getChanged()\n    println \"conflicting \" + status.getConflicting()\n    println \"missing \" + status.getMissing()\n    println \"modified \" + status.getModified()\n    println \"removed \" + status.getRemoved()\n    println \"untracked \" + status.getUntracked()\n\n"}}