Friday, October 23, 2020

JGit's addCeilingDirectory adds an exclusive bound

A Gradle plugin I worked on uses the JGit library to check the state of the project's Git repository, if it's in one. A discrepancy in behavior between Java versions led me to investigate the FileRepositoryBuilder setup. addCeilingDirectory is supposed to set the outermost directory that will be searched by findGitDir, but due to the order in which findGitDir updates its "directory under examination" variable and checks whether the ceiling has been hit, the specified ceiling will actually not be checked. To work around this, I specified the parent directory of my intended ceiling.

No comments:

Post a Comment