Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-51036] -Dignore.dirt
  • Loading branch information
jglick committed May 8, 2018
1 parent d57691b commit 21486f5
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -62,6 +62,7 @@
@Component(role=AbstractMavenLifecycleParticipant.class, hint="git-changelist-maven-extension")
public class Main extends AbstractMavenLifecycleParticipant {

private static final String IGNORE_DIRT = "ignore.dirt";
private static final int ABBREV_LENGTH = 12;

@Requirement
Expand All @@ -83,8 +84,13 @@ public void afterSessionStart(MavenSession session) throws MavenExecutionExcepti
// Could consider instead making this append a timestamp baased on the most recent file modification.
Set<String> paths = new TreeSet<>(status.getUncommittedChanges());
paths.addAll(status.getUntracked());
String error = "Make sure `git status -s` is empty before using -Dset.changelist: " + paths;
// Note that `git st` does not care about untracked _folders_ so long as there are no relevant _files_ inside them.
throw new MavenExecutionException("Make sure `git status -s` is empty before using -Dset.changelist: " + paths, (Throwable) null);
if ("true".equals(props.getProperty(IGNORE_DIRT))) {
log.warn(error);
} else {
throw new MavenExecutionException(error + " (use -D" + IGNORE_DIRT + " to make this nonfatal)", (Throwable) null);
}
}
Repository repo = git.getRepository();
ObjectId head = repo.resolve("HEAD");
Expand Down

0 comments on commit 21486f5

Please sign in to comment.