Skip to content
Merged
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
11 changes: 10 additions & 1 deletion src/main/java/pl/project13/jgit/DescribeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,16 @@ boolean findDirtyState(Repository repo) throws GitAPIException {
Git git = Git.wrap(repo);
Status status = git.status().call();

boolean isDirty = !status.isClean();
// Git describe doesn't mind about untracked files when checking if
// repo is dirty. JGit does this, so we cannot use the isClean method
// to get the same behaviour. Instead check dirty state without
// status.getUntracked().isEmpty()
boolean isDirty = !(status.getAdded().isEmpty() //
&& status.getChanged().isEmpty() //
&& status.getRemoved().isEmpty() //
&& status.getMissing().isEmpty() //
&& status.getModified().isEmpty() //
&& status.getConflicting().isEmpty());

log("Repo is in dirty state = [%s] ", isDirty);
return isDirty;
Expand Down