Zero-shot:
Generate commit messages based on code diff. Provide succinct and informative commit messages that precisely encapsulate the modifications within the code. Utilize proper language and adhere to the conventions typically observed in commit messages. Your responses should be limited to commit messages exclusively, omitting any explanations or translations. Generate commit message for the following code diff.
[diff]





One-shot:
Generate commit messages based on code diff. Provide succinct and informative commit messages that precisely encapsulate the modifications within the code. Utilize proper language and adhere to the conventions typically observed in commit messages. Your responses should be limited to commit messages exclusively, omitting any explanations or translations. Next, I will provide you with a refined example for reference.
Here is the code diff:
diff --git a/TagService_old.java b/TagService_new.java
index 1992eb2..afd05df 100644
--- a/TagService_old.java
+++ b/TagService_new.java
@@ -31,6 +31,7 @@ public interface TagService extends CrudService<Tag, Integer> {
      * @param name name
      * @return Tag
      */
+    @Nullable
     Tag getByName(@NonNull String name);

     /**
diff --git a/CategoryServiceImpl_old.java b/CategoryServiceImpl_new.java
index 0d8b850..fff4aa1 100644
--- a/CategoryServiceImpl_old.java
+++ b/CategoryServiceImpl_new.java
@@ -16,6 +16,7 @@ import run.halo.app.repository.CategoryRepository;
 import run.halo.app.service.CategoryService;
 import run.halo.app.service.PostCategoryService;
 import run.halo.app.service.base.AbstractCrudService;
+import run.halo.app.utils.ServiceUtils;

 import java.util.Collections;
 import java.util.LinkedList;
@@ -56,7 +57,7 @@ public class CategoryServiceImpl extends AbstractCrudService<Category, Integer>
         }

         // Check parent id
-        if (category.getParentId() > 0) {
+        if (!ServiceUtils.isEmptyId(category.getParentId())) {
             count = categoryRepository.countById(category.getParentId());

             if (count == 0) {
This is the generated message: Fix NPE when importing markdown files.
Generate commit message for the following code diff.
[diff]




Multi-shot:
Generate commit messages based on code diff. Provide succinct and informative commit messages that precisely encapsulate the modifications within the code. Utilize proper language and adhere to the conventions typically observed in commit messages. Your responses should be limited to commit messages exclusively, omitting any explanations or translations. In the following, I will present you with three exquisite examples for your reference.
Here is the code diff:
diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java
index 117f2fdbe40..4ee010ac7c6 100644
--- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java
+++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetQuery.java
@@ -55,12 +55,13 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr
       response = (List<OIdentifiable>) db.command(new OSQLSynchQuery<ORecordSchemaAware<?>>(text, limit).setFetchPlan(fetchPlan))
           .execute();

+      iResponse.writeRecords(response, fetchPlan);
+
     } finally {
       if (db != null)
         db.close();
     }

-    iResponse.writeRecords(response, fetchPlan);
     return false;
   }
This is the generated message: Fixed GET query command with nested elements that require an active connection.
Here is the code diff:
diff --git a/TagService_old.java b/TagService_new.java
index 1992eb2..afd05df 100644
--- a/TagService_old.java
+++ b/TagService_new.java
@@ -31,6 +31,7 @@ public interface TagService extends CrudService<Tag, Integer> {
      * @param name name
      * @return Tag
      */
+    @Nullable
     Tag getByName(@NonNull String name);

     /**
diff --git a/CategoryServiceImpl_old.java b/CategoryServiceImpl_new.java
index 0d8b850..fff4aa1 100644
--- a/CategoryServiceImpl_old.java
+++ b/CategoryServiceImpl_new.java
@@ -16,6 +16,7 @@ import run.halo.app.repository.CategoryRepository;
 import run.halo.app.service.CategoryService;
 import run.halo.app.service.PostCategoryService;
 import run.halo.app.service.base.AbstractCrudService;
+import run.halo.app.utils.ServiceUtils;

 import java.util.Collections;
 import java.util.LinkedList;
@@ -56,7 +57,7 @@ public class CategoryServiceImpl extends AbstractCrudService<Category, Integer>
         }

         // Check parent id
-        if (category.getParentId() > 0) {
+        if (!ServiceUtils.isEmptyId(category.getParentId())) {
             count = categoryRepository.countById(category.getParentId());

             if (count == 0) {
This is the generated message: Fix NPE when importing markdown files.
Here is the code diff:
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerAdapter.java
index a599f668a580..42e4b47dd8bb 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerAdapter.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerAdapter.java
@@ -63,10 +63,9 @@ public ModelAndView handle(HttpServletRequest request, HttpServletResponse respo
 	@Override
 	public long getLastModified(HttpServletRequest request, Object handler) {
 		Optional<HandlerAdapter> adapter = getAdapter(handler);
-		if (adapter.isPresent()) {
-			return adapter.get().getLastModified(request, handler);
-		}
-		return 0;
+		return adapter
+				.map((handlerAdapter) -> handlerAdapter.getLastModified(request, handler))
+				.orElse(0L);
 	}

 	private Optional<HandlerAdapter> getAdapter(Object handler) {
This is the generated message: Use Optional value in more functional style.
Generate commit message for the following code diff.
[diff]