{"thread":{"id":"53414","subject":"[PATCH] commit: silence git-gc if --quiet is given","startedAt":"2020-05-06T14:03:06Z","lastAt":"2020-05-06T17:33:28Z","messageCount":3,"participants":["Abhishek Kumar","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"397186","messageId":"20200506140138.650455-1-abhishekkumar8222@gmail.com","threadId":"53414","inReplyTo":null,"subject":"[PATCH] commit: silence git-gc if --quiet is given","fromName":"Abhishek Kumar","fromEmail":"abhishekkumar8222@gmail.com","sentAt":"2020-05-06T14:01:38Z","receivedAt":"2020-05-06T14:03:06Z","isPatch":true,"sender":{"key":"abhishekkumar8222@gmail.com","avatar":"https://avatars.githubusercontent.com/u/31231064?v=4"},"body":"As reported by Perrick [1], commit does not propagate quiet behavior to\ngc if present. While we are at it, convert argv_gc_auto to struct argv_array.\n\n[1]: https://lore.kernel.org/git/20200506094327.GC31637@rillettes/\n\nReported-by: Pierrick Gaudry <pierrick.gaudry@loria.fr>\nSigned-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n---\n builtin/commit.c | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex a73de0a4c5..a48e312ebd 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1494,7 +1494,7 @@ static int git_commit_config(const char *k, const char *v, void *cb)\n \n int cmd_commit(int argc, const char **argv, const char *prefix)\n {\n-\tconst char *argv_gc_auto[] = {\"gc\", \"--auto\", NULL};\n+\tstruct argv_array argv_gc_auto = ARGV_ARRAY_INIT;\n \tstatic struct wt_status s;\n \tstatic struct option builtin_commit_options[] = {\n \t\tOPT__QUIET(&quiet, N_(\"suppress summary after successful commit\")),\n@@ -1703,7 +1703,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tgit_test_write_commit_graph_or_die();\n \n \trepo_rerere(the_repository, 0);\n-\trun_command_v_opt(argv_gc_auto, RUN_GIT_CMD);\n+\targv_array_pushl(&argv_gc_auto, \"gc\", \"--auto\", NULL);\n+\tif (quiet)\n+\t\targv_array_push(&argv_gc_auto, \"--quiet\");\n+\trun_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD);\n+\targv_array_clear(&argv_gc_auto);\n \trun_commit_hook(use_editor, get_index_file(), \"post-commit\", NULL);\n \tif (amend && !no_post_rewrite) {\n \t\tcommit_post_rewrite(the_repository, current_head, &oid);\n-- \n2.26.0\n\n"},{"id":"397192","messageId":"CAPig+cSi5xe_FSzr7Z3D6+f1WxsbPthQnWcE1FrLyhrmi4TCGg@mail.gmail.com","threadId":"53414","inReplyTo":"20200506140138.650455-1-abhishekkumar8222@gmail.com","subject":"Re: [PATCH] commit: silence git-gc if --quiet is given","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-05-06T16:09:06Z","receivedAt":"2020-05-06T16:09:22Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, May 6, 2020 at 10:03 AM Abhishek Kumar\n<abhishekkumar8222@gmail.com> wrote:\n> As reported by Perrick [1], commit does not propagate quiet behavior to\n> gc if present. While we are at it, convert argv_gc_auto to struct argv_array.\n>\n> [1]: https://lore.kernel.org/git/20200506094327.GC31637@rillettes/\n\nAccording to the source you cite, this sort of issue has come up\nbefore in a different context (git-fetch). Do we know if there are\nother commands which invoke git-gc which might also suffer the same\nissue? It would be nice for the commit message to say something about\nthis... for instance, that git-commit is the final command which needs\nthis fix or, if not, which additional commands are likely to need the\nsame treatment.\n\n> Reported-by: Pierrick Gaudry <pierrick.gaudry@loria.fr>\n> Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>\n"},{"id":"397217","messageId":"xmqq8si56k9v.fsf@gitster.c.googlers.com","threadId":"53414","inReplyTo":"CAPig+cSi5xe_FSzr7Z3D6+f1WxsbPthQnWcE1FrLyhrmi4TCGg@mail.gmail.com","subject":"Re: [PATCH] commit: silence git-gc if --quiet is given","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-06T17:33:16Z","receivedAt":"2020-05-06T17:33:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Wed, May 6, 2020 at 10:03 AM Abhishek Kumar\n> <abhishekkumar8222@gmail.com> wrote:\n>> As reported by Perrick [1], commit does not propagate quiet behavior to\n>> gc if present. While we are at it, convert argv_gc_auto to struct argv_array.\n>>\n>> [1]: https://lore.kernel.org/git/20200506094327.GC31637@rillettes/\n>\n> According to the source you cite, this sort of issue has come up\n> before in a different context (git-fetch). Do we know if there are\n> other commands which invoke git-gc which might also suffer the same\n> issue?\n\nI just wrote my analysis to the original thread.  It looks to me a\nfairly low-hanging fruit.\n\n"}]}