I have a folder full of files and I want to get the timestamps of last git update for each of those files.
I'd like to get those in a Gradle task.
I tried the following with GrGit:
def git = org.ajoberstar.grgit.Grgit.open dir:project.rootDir
task showGit() {
doFirst {
file( "$project.rootDir/src/main/java/some/folder" ).listFiles().each{ f ->
git.log( includes:[ 'HEAD' ], paths:[ f.name ] ).each{
println "$f.name -> Author: $it.author.name - Date: ${it.date.format( 'dd.MM.yyyy HH:mm' )}"
}
}
}
}
but it prints nothing.
If I ommit the paths
like so:
task showGit() {
doFirst {
git.log( includes:[ 'HEAD' ] ).each{
println "Author: $it.author.name - Date: ${it.date.format( 'dd.MM.yyyy HH:mm' )}"
}
}
}
it prints all commit infos for the whole dir.
How to get the timestamps for each file?