git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] [Outreachy] commit.c: clarify comment describing commit re-parse behavior

From
OAOkhuomon Ajayi <okhuomonajayi54@gmail.com>
Date
Oct 11, 2025, 09:36 UTC
Message-ID
<20251011093611.62937-1-okhuomonajayi54@gmail.com>

The existing comment in `parse_commit_buffer()` mentioned a "leftover from an earlier failed parse", which could be confusing to new readers. It implied an error state rather than the intended cleanup before re-parsing a commit.

Clarifying the comment makes it explicit that we reset the parent list to ensure a clean state before re-parsing, which improves readability and avoids misunderstanding during future maintenance.

Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
 commit.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/commit.c b/commit.c
index 16d91b2bfc..af20ca7c3d 100644
--- a/commit.c
+++ b/commit.c
@@ -475,10 +475,9 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
 	if (item->object.parsed)
 		return 0;
 	/*
-	 * Presumably this is leftover from an earlier failed parse;
-	 * clear it out in preparation for us re-parsing (we'll hit the
-	 * same error, but that's good, since it lets our caller know
-	 * the result cannot be trusted.
+	 * Reset the parent list before re-parsing to ensure a clear
+	 * commit state. This avoids carrying over data from a previous
+	 * incomplete or invalid parse.
 	 */
 	free_commit_list(item->parents);
 	item->parents = NULL;
-- 
2.43.0
Next: Christian Couder
Message 1 of 4 in “[Outreachy] commit.c: clarify comment describing commit re-parse behavior”
  1. [Outreachy] commit.c: clarify comment describing commit re-parse behaviorOkhuomon Ajayi, Oct 11, 2025
  2. Christian CouderOct 13, 2025
  3. Jeff KingOct 14, 2025
  4. Okhuomon AjayiOct 14, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.