Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions gradle/validation/git-status.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ configure(rootProject) {
doFirst {
try {
def repository = new FileRepositoryBuilder()
.findGitDir(rootProject.projectDir)
.setWorkTree(rootProject.projectDir)
.setMustExist(true)
.build()
Expand All @@ -65,6 +66,7 @@ configure(rootProject) {
def status
try {
def repository = new FileRepositoryBuilder()
.findGitDir(rootProject.projectDir)
.setWorkTree(rootProject.projectDir)
.setMustExist(true)
.build()
Expand All @@ -73,15 +75,9 @@ configure(rootProject) {
status = null
}
if (status == null) {
if (file("${rootProject.projectDir}/.git").exists()) {
// Ignore git worktree branches until jgit supports them.
logger
.warn("WARNING: git worktrees are not supported by jgit (won't check dirty files): ${rootProject.projectDir}")
} else {
// Ignore the check. This isn't a git checkout.
logger
.warn("WARNING: Directory is not a valid git checkout (won't check dirty files): ${rootProject.projectDir}")
}
// Ignore the check. This isn't a git checkout.
logger
.warn("WARNING: Directory is not a valid git checkout (won't check dirty files): ${rootProject.projectDir}")
} else {
// git ignores any folders which are empty (this includes folders with recursively empty sub-folders).
def untrackedNonEmptyFolders = status.untrackedFolders.findAll {path ->
Expand Down
4 changes: 3 additions & 1 deletion gradle/validation/rat-sources.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ Set<String> loadGitTrackedFiles() {
rootProject.ext.ratGitIndexLoaded = true
rootProject.ext.ratGitTrackedFiles = null

// .git is a file (not a directory) in a git worktree
def dotGit = new File(rootProject.projectDir, ".git")
if (!dotGit.isDirectory()) {
if (!dotGit.exists()) {
return null // not a git repository
}

def repository = null
try {
repository = new FileRepositoryBuilder()
.findGitDir(rootProject.projectDir)
.setWorkTree(rootProject.projectDir)
.setMustExist(true)
.build()
Expand Down
Loading