{"thread":{"id":"63580","subject":"[PATCH] bundle-uri: replace printf with fprintf in print_bundle_uri function","startedAt":"2025-06-04T07:59:23Z","lastAt":"2025-06-04T17:11:25Z","messageCount":3,"participants":["Jan Mazur via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"519642","messageId":"pull.1985.git.git.1749023960409.gitgitgadget@gmail.com","threadId":"63580","inReplyTo":null,"subject":"[PATCH] bundle-uri: replace printf with fprintf in print_bundle_uri function","fromName":"Jan Mazur via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-06-04T07:59:20Z","receivedAt":"2025-06-04T07:59:23Z","isPatch":true,"sender":{"key":"name:Jan Mazur","avatar":null},"body":"From: Jan Mazur <mzr@fb.com>\n\nSigned-off-by: Jan Mazur <mzr@meta.com>\n---\n    bundle-uri: replace printf with fprintf in print_bundle_uri function\n    \n    Small fix to bundle-uri convenience debug function.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1985%2Fmzr%2Fbundle_uri__print_bundle_list_fix-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1985/mzr/bundle_uri__print_bundle_list_fix-v1\nPull-Request: https://github.com/git/git/pull/1985\n\n bundle-uri.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 9accf157b44..c9d65aa0ce8 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -122,7 +122,7 @@ void print_bundle_list(FILE *fp, struct bundle_list *list)\n \t\tint i;\n \t\tfor (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) {\n \t\t\tif (heuristics[i].heuristic == list->heuristic) {\n-\t\t\t\tprintf(\"\\theuristic = %s\\n\",\n+\t\t\t\tfprintf(fp, \"\\theuristic = %s\\n\",\n \t\t\t\t       heuristics[list->heuristic].name);\n \t\t\t\tbreak;\n \t\t\t}\n\nbase-commit: b07857f7dcffee4d3b428df8dce6c9b49a57c9c1\n-- \ngitgitgadget\n"},{"id":"519679","messageId":"xmqqy0u7bi9j.fsf@gitster.g","threadId":"63580","inReplyTo":"pull.1985.git.git.1749023960409.gitgitgadget@gmail.com","subject":"Re: [PATCH] bundle-uri: replace printf with fprintf in print_bundle_uri function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-06-04T16:09:44Z","receivedAt":"2025-06-04T16:09:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Jan Mazur via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Subject: [PATCH] bundle-uri: replace printf with fprintf in print_bundle_uri function\n\nThat says _what_ the patch does.  We care more deeply about _why_ it\nis a good idea for a patch to do so.  And ...\n\n> From: Jan Mazur <mzr@fb.com>\n\n... there is nothing described here.\n\n> Signed-off-by: Jan Mazur <mzr@meta.com>\n\nSomething like this, perhaps?\n\n    Subject: [PATCH] bundle-uri: send debug output to given FILE * stream\n\n    d796cedb (bundle-uri: unit test \"key=value\" parsing, 2022-10-12)\n    introduced the print_bundle_list() function, which takes a \"FILE\n    *fp\" to write the output to.  Later with c93c3d2f (bundle-uri:\n    parse bundle.heuristic=creationToken, 2023-01-31) the function\n    started showing additional information, which is always written\n    to the standard output stream.\n\n    It does not look like a deliberate decision to do so, and it\n    does not hurt, as all callers of the function passes stdout to\n    it.\n    \n    We could change the function not to take fp and always write to\n    the standard output to simplify, but let's use the FILE *fp\n    provided by the caller consistently to write out output.\n\nThe change the patch makes looks obviously correct.\n\nThanks.\n\n> ---\n>     bundle-uri: replace printf with fprintf in print_bundle_uri function\n>     \n>     Small fix to bundle-uri convenience debug function.\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1985%2Fmzr%2Fbundle_uri__print_bundle_list_fix-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1985/mzr/bundle_uri__print_bundle_list_fix-v1\n> Pull-Request: https://github.com/git/git/pull/1985\n>\n>  bundle-uri.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/bundle-uri.c b/bundle-uri.c\n> index 9accf157b44..c9d65aa0ce8 100644\n> --- a/bundle-uri.c\n> +++ b/bundle-uri.c\n> @@ -122,7 +122,7 @@ void print_bundle_list(FILE *fp, struct bundle_list *list)\n>  \t\tint i;\n>  \t\tfor (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) {\n>  \t\t\tif (heuristics[i].heuristic == list->heuristic) {\n> -\t\t\t\tprintf(\"\\theuristic = %s\\n\",\n> +\t\t\t\tfprintf(fp, \"\\theuristic = %s\\n\",\n>  \t\t\t\t       heuristics[list->heuristic].name);\n>  \t\t\t\tbreak;\n>  \t\t\t}\n>\n> base-commit: b07857f7dcffee4d3b428df8dce6c9b49a57c9c1\n"},{"id":"519683","messageId":"pull.1985.v2.git.git.1749057081918.gitgitgadget@gmail.com","threadId":"63580","inReplyTo":"pull.1985.git.git.1749023960409.gitgitgadget@gmail.com","subject":"[PATCH v2] bundle-uri: send debug output to given FILE * stream","fromName":"Jan Mazur via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-06-04T17:11:21Z","receivedAt":"2025-06-04T17:11:25Z","isPatch":true,"sender":{"key":"name:Jan Mazur","avatar":null},"body":"From: Jan Mazur <mzr@fb.com>\n\nd796cedb (bundle-uri: unit test \"key=value\" parsing, 2022-10-12)\nintroduced the print_bundle_list() function, which takes a \"FILE\n*fp\" to write the output to.  Later with c93c3d2f (bundle-uri:\nparse bundle.heuristic=creationToken, 2023-01-31) the function\nstarted showing additional information, which is always written\nto the standard output stream.\n\nIt does not look like a deliberate decision to do so, and it\ndoes not hurt, as all callers of the function passes stdout to\nit.\n\nWe could change the function not to take fp and always write to\nthe standard output to simplify, but let's use the FILE *fp\nprovided by the caller consistently to write out output.\n\nSigned-off-by: Jan Mazur <mzr@meta.com>\n---\n    bundle-uri: send debug output to given FILE * stream\n    \n    Small fix to bundle-uri convenience debug function.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1985%2Fmzr%2Fbundle_uri__print_bundle_list_fix-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1985/mzr/bundle_uri__print_bundle_list_fix-v2\nPull-Request: https://github.com/git/git/pull/1985\n\nRange-diff vs v1:\n\n 1:  83cbf182253 ! 1:  38f05164811 bundle-uri: replace printf with fprintf in print_bundle_uri function\n     @@ Metadata\n      Author: Jan Mazur <mzr@fb.com>\n      \n       ## Commit message ##\n     -    bundle-uri: replace printf with fprintf in print_bundle_uri function\n     +    bundle-uri: send debug output to given FILE * stream\n     +\n     +    d796cedb (bundle-uri: unit test \"key=value\" parsing, 2022-10-12)\n     +    introduced the print_bundle_list() function, which takes a \"FILE\n     +    *fp\" to write the output to.  Later with c93c3d2f (bundle-uri:\n     +    parse bundle.heuristic=creationToken, 2023-01-31) the function\n     +    started showing additional information, which is always written\n     +    to the standard output stream.\n     +\n     +    It does not look like a deliberate decision to do so, and it\n     +    does not hurt, as all callers of the function passes stdout to\n     +    it.\n     +\n     +    We could change the function not to take fp and always write to\n     +    the standard output to simplify, but let's use the FILE *fp\n     +    provided by the caller consistently to write out output.\n      \n          Signed-off-by: Jan Mazur <mzr@meta.com>\n      \n\n\n bundle-uri.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 9accf157b44..c9d65aa0ce8 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -122,7 +122,7 @@ void print_bundle_list(FILE *fp, struct bundle_list *list)\n \t\tint i;\n \t\tfor (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) {\n \t\t\tif (heuristics[i].heuristic == list->heuristic) {\n-\t\t\t\tprintf(\"\\theuristic = %s\\n\",\n+\t\t\t\tfprintf(fp, \"\\theuristic = %s\\n\",\n \t\t\t\t       heuristics[list->heuristic].name);\n \t\t\t\tbreak;\n \t\t\t}\n\nbase-commit: b07857f7dcffee4d3b428df8dce6c9b49a57c9c1\n-- \ngitgitgadget\n"}]}