Skip to content
Snippets Groups Projects

Detect uncommited changes in repository

Merged Mikolai Gütschow requested to merge git-detect-dirty into main
1 file
+ 2
1
Compare changes
  • Side-by-side
  • Inline
@@ -118,6 +118,7 @@ open class GenerateBuildDataSourceTask : AbstractBuildDataTask() {
val dir = project.projectDir
val git = Git.open(dir)
val repository = git.repository
val status = git.status().call()
// Find and open core repository
val repositoryCore = SubmoduleWalk.getSubmoduleRepository(repository, "briar")
@@ -126,7 +127,7 @@ open class GenerateBuildDataSourceTask : AbstractBuildDataTask() {
// Get head ref and it's name => current hash
val head = repository.resolve(Constants.HEAD)
val gitHash = head.name
val gitHash = head.name + if (status.hasUncommittedChanges()) "-dirty" else ""
// Get latest commit and its commit time
val first: RevCommit = try {
Loading