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

[PATCH 2/4] rerere: fix comment on handle_file() helper

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 24, 2023, 20:54 UTC
Message-ID
<20230824205456.1231371-3-gitster@pobox.com>
In-Reply-To
<20230824205456.1231371-1-gitster@pobox.com>

The return value from handle_path() is returned to the caller of handle_file() in the normal cases, and it is not the number of hunks. It is just a normal C Boolean, "do we (!=0) or do we not (0) have conflict?" plus "a negative return value signals an error".

And all the callers of handle_file() understands its return value as such. Update the comment to match the reality after 221444f5 (rerere: only return whether a path has conflicts or not, 2018-08-05), which apparently forgot to update this comment when it turned the returned value of this function from the number of conflict hunks to a boolean plus error.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
cc: Thomas Gummerer <t.gummerer@gmail.com>
---
 rerere.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rerere.c b/rerere.c
index 73cdc8392f..4ce1270a94 100644
--- a/rerere.c
+++ b/rerere.c
@@ -454,7 +454,7 @@ static int handle_path(unsigned char *hash, struct rerere_io *io, int marker_siz
 
 /*
  * Scan the path for conflicts, do the "handle_path()" thing above, and
- * return the number of conflict hunks found.
+ * return true iff conflict hunks were found.
  */
 static int handle_file(struct index_state *istate,
 		       const char *path, unsigned char *hash, const char *output)
-- 
2.42.0-29-gcd9da15a85
Previous: Junio C Hamano
Message 5 of 5 in “code clean-up for rerere”
  1. 0/4 code clean-up for rerereJunio C Hamano, Aug 24, 2023
  2. 3/4 rerere: try_merge() should use LL_MERGE_ERROR when it means an errorJunio C Hamano, Aug 24, 2023
  3. 1/4 rerere: simplify check_one_conflict() helper functionJunio C Hamano, Aug 24, 2023
  4. 4/4 rerere: modernize use of empty strbufJunio C Hamano, Aug 24, 2023
  5. 2/4 rerere: fix comment on handle_file() helperJunio C Hamano, Aug 24, 2023

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.