Commit Diff


commit - 01073a5d20f017cbdb065decd25fa6d472cf809d
commit + 24ea5512e058a018fb480a73576e051ee37991ff
blob - 0b3586f662285bd616e529dc71368b14a7e6501e
blob + fac5ad88780771915571b063b0545b79b3749db3
--- got/got.c
+++ got/got.c
@@ -6024,7 +6024,7 @@ cat_commit(struct got_object_id *id, struct got_reposi
 	const struct got_object_id_queue *parent_ids;
 	struct got_object_qid *pid;
 	char *id_str = NULL;
-	char *logmsg = NULL;
+	const char *logmsg = NULL;
 	int i;
 
 	err = got_object_open_as_commit(&commit, repo, id);
@@ -6058,12 +6058,11 @@ cat_commit(struct got_object_id *id, struct got_reposi
 	fprintf(outfile, "committer-time: %lld\n",
 	    got_object_commit_get_committer_time(commit));
 
-	err = got_object_commit_get_logmsg(&logmsg, commit);
+	logmsg = got_object_commit_get_logmsg_raw(commit);
 	fprintf(outfile, "log-message: %zd bytes\n", strlen(logmsg));
 	fprintf(outfile, "%s", logmsg);
 done:
 	free(id_str);
-	free(logmsg);
 	got_object_commit_close(commit);
 	return err;
 }
blob - ceae59cbb94ce2b6ea9842e276aa873a7b7c483b
blob + 37d13aed45bc4261d0258d102a275f5808d73bc8
--- include/got_object.h
+++ include/got_object.h
@@ -138,10 +138,17 @@ time_t got_object_commit_get_committer_time(struct got
 /* Get a committer's timezone offset. */
 time_t got_object_commit_get_committer_gmtoff(struct got_commit_object *);
 
-/* Get the commit log message. The caller must dispose of it with free(3). */
+/*
+ * Get the commit log message.
+ * PGP-signatures contained in the log message will be stripped.
+ * The caller must dispose of it with free(3).
+ */
 const struct got_error *got_object_commit_get_logmsg(char **,
     struct got_commit_object *);
 
+/* Get the raw commit log message.*/
+const char *got_object_commit_get_logmsg_raw(struct got_commit_object *);
+
 /*
  * Attempt to open a tree object in a repository.
  * The caller must dispose of the tree with got_object_tree_close().
blob - bf2e9f2ec10bebbef9454911e9980f3f1250ffbb
blob + 8a9418989e78b84876e0c489d374e0d53cf917e7
--- lib/object_parse.c
+++ lib/object_parse.c
@@ -478,6 +478,12 @@ done:
 		*logmsg = NULL;
 	}
 	return err;
+}
+
+const char *
+got_object_commit_get_logmsg_raw(struct got_commit_object *commit)
+{
+	return commit->logmsg;
 }
 
 const struct got_error *