Skip to content

Commit

Permalink
Do not show stack trace on missing commit
Browse files Browse the repository at this point in the history
A missing commit message is not sufficient to justify the distraction
of a stack trace in the log.  State that the commit message cannot be
displayed because the commit cannot be found.
  • Loading branch information
MarkEWaite committed Jan 11, 2023
1 parent 653efc3 commit 22f8ceb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/hudson/plugins/git/GitSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,9 @@ private void printCommitMessageToLog(TaskListener listener, GitClient git, final
try {
RevCommit commit = git.withRepository(new RevCommitRepositoryCallback(revToBuild));
listener.getLogger().println("Commit message: \"" + commit.getShortMessage() + "\"");
} catch (InterruptedException | MissingObjectException e) {
} catch (MissingObjectException e) {
listener.getLogger().println("Commit '" + e.getObjectId() + "' not found - no commit message to print");
} catch (InterruptedException e) {
e.printStackTrace(listener.error("Unable to retrieve commit message"));
}
}
Expand Down

0 comments on commit 22f8ceb

Please sign in to comment.