{"thread":{"id":"50851","subject":"[PATCH] index-pack: show progress while checking objects","startedAt":"2019-03-31T23:12:43Z","lastAt":"2019-03-31T23:12:43Z","messageCount":1,"participants":["SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"372850","messageId":"20190331231235.8131-1-szeder.dev@gmail.com","threadId":"50851","inReplyTo":null,"subject":"[PATCH] index-pack: show progress while checking objects","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-03-31T23:12:35Z","receivedAt":"2019-03-31T23:12:43Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"When 'git index-pack' is run by 'git clone', its check_objects()\nfunction usually doesn't take long enough to be a concern, but I just\nrun into a situation where it took about a minute or so: I\ninadvertently put some memory pressure on my tiny laptop while cloning\nlinux.git, and then there was quite a long silence between the\n\"Resolving deltas\" and \"Checking connectivity\" progress bars.\n\nShow a progress bar during the loop of check_objects() to let the user\nknow that something is still going on.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n builtin/index-pack.c | 10 +++++++++-\n 1 file changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 31046c7a0a..ccf4eb7e9b 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -219,8 +219,16 @@ static unsigned check_objects(void)\n \tunsigned i, max, foreign_nr = 0;\n \n \tmax = get_max_object_index();\n-\tfor (i = 0; i < max; i++)\n+\n+\tif (verbose)\n+\t\tprogress = start_delayed_progress(_(\"Checking objects\"), max);\n+\n+\tfor (i = 0; i < max; i++) {\n \t\tforeign_nr += check_object(get_indexed_object(i));\n+\t\tdisplay_progress(progress, i + 1);\n+\t}\n+\n+\tstop_progress(&progress);\n \treturn foreign_nr;\n }\n \n-- \n2.21.0.539.g07239c3a71.dirty\n\n"}]}