{"thread":{"id":"62944","subject":"[PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c","startedAt":"2025-02-12T19:29:54Z","lastAt":"2025-02-12T21:16:19Z","messageCount":3,"participants":["Moumita","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"512330","messageId":"20250212192841.8321-1-dhar61595@gmail.com","threadId":"62944","inReplyTo":null,"subject":"[PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c","fromName":"Moumita","fromEmail":"dhar61595@gmail.com","sentAt":"2025-02-12T19:28:39Z","receivedAt":"2025-02-12T19:29:54Z","isPatch":true,"sender":{"key":"dhar61595@gmail.com","avatar":"https://avatars.githubusercontent.com/u/101038146?v=4"},"body":"The `flags` variable  holds multiple bitwise flags (PARENT1, PARENT2, STALE),these flags are defined using (1u << N), so maybe there will be no issues if it is changed from `int` to `unsigned int`\n\nMoumita (1):\n  commit-reach: use unsigned int for flags in paint_down_to_common()\n\n commit-reach.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n-- \n2.48.0\n\n"},{"id":"512331","messageId":"20250212192841.8321-2-dhar61595@gmail.com","threadId":"62944","inReplyTo":"20250212192841.8321-1-dhar61595@gmail.com","subject":"[PATCH 1/1] commit-reach: use unsigned int for flags in paint_down_to_common()","fromName":"Moumita","fromEmail":"dhar61595@gmail.com","sentAt":"2025-02-12T19:28:40Z","receivedAt":"2025-02-12T19:30:03Z","isPatch":true,"sender":{"key":"dhar61595@gmail.com","avatar":"https://avatars.githubusercontent.com/u/101038146?v=4"},"body":"The `flags` variable in `paint_down_to_common()` stores bitwise flags\n(PARENT1, PARENT2, and STALE), which are defined as `(1u << N)`.\nSince these are already unsigned values,`flags` can also be declared as\n`unsigned int` instead of `int`.\n\nSigned-off-by: Moumita <dhar61595@gmail.com>\n---\n commit-reach.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/commit-reach.c b/commit-reach.c\nindex a339e41aa4..a4aaae2737 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -79,7 +79,7 @@ static int paint_down_to_common(struct repository *r,\n \twhile (queue_has_nonstale(&queue)) {\n \t\tstruct commit *commit = prio_queue_get(&queue);\n \t\tstruct commit_list *parents;\n-\t\tint flags;\n+\t\tunsigned int flags;\n \t\ttimestamp_t generation = commit_graph_generation(commit);\n \n \t\tif (min_generation && generation > last_gen)\n-- \n2.48.0\n\n"},{"id":"512332","messageId":"xmqqfrkiuan3.fsf@gitster.g","threadId":"62944","inReplyTo":"20250212192841.8321-1-dhar61595@gmail.com","subject":"Re: [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-02-12T21:16:16Z","receivedAt":"2025-02-12T21:16:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Moumita <dhar61595@gmail.com> writes:\n\n> The `flags` variable holds multiple bitwise flags (PARENT1,\n> PARENT2, STALE),these flags are defined using (1u << N), so maybe\n> there will be no issues if it is changed from `int` to `unsigned\n> int`\n\n\"This change will not break\" is not a good reason to make the\nchange, though, as not making that change will not break anything,\neither.\n\nIf you need to write something, say something that positively\njustifies the change, explaining readers why it is a good thing to\ndo, and how the resulting code is _better_ than the original.\n\nThanks.\n\n"}]}