diff --git a/src/main/java/com/ly/doc/helper/GitHelper.java b/src/main/java/com/ly/doc/helper/GitHelper.java index 2b10108d..a82c1f19 100644 --- a/src/main/java/com/ly/doc/helper/GitHelper.java +++ b/src/main/java/com/ly/doc/helper/GitHelper.java @@ -116,6 +116,10 @@ public String getLatestCommitId() { try { ObjectId objectId = repository.resolve("HEAD"); + // if not exist (the repository is init), return empty string + if (null == objectId) { + return ""; + } return objectId.getName(); } catch (IOException e) { throw new RuntimeException(e);