summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2020-07-10 19:02:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-07-15 18:57:19 (GMT)
commit862aead24eaf797860fb503561a1f86adf557abb (patch)
treece9c46dbeb1afc25a8152f06219c15b16d8eea53
parent2f00c355cb79ee86bddc9f2fef91ac380a6023fc (diff)
downloadgit-862aead24eaf797860fb503561a1f86adf557abb.zip
git-862aead24eaf797860fb503561a1f86adf557abb.tar.gz
git-862aead24eaf797860fb503561a1f86adf557abb.tar.bz2
commit-graph: fix "Collecting commits from input" progress line
To display a progress line while reading commits from standard input and looking them up, 5b6653e523 (builtin/commit-graph.c: dereference tags in builtin, 2020-05-13) should have added a pair of start_delayed_progress() and stop_progress() calls around the loop reading stdin. Alas, the stop_progress() call ended up at the wrong place, after write_commit_graph(), which does all the commit-graph computation and writing, and has several progress lines of its own. Consequently, that new Collecting commits from input: 1234 progress line is overwritten by the first progress line shown by write_commit_graph(), and its final "done" line is shown last, after everything is finished: $ { sleep 3 ; git rev-list -3 HEAD ; sleep 1 ; } | ~/src/git/git commit-graph write --stdin-commits Expanding reachable commits in commit graph: 873402, done. Writing out commit graph in 4 passes: 100% (3493608/3493608), done. Collecting commits from input: 3, done. Furthermore, that stop_progress() call was added after the 'cleanup' label, where that loop reading stdin jumps in case of an error. In case of invalid input this then results in the "done" line shown after the error message: $ { sleep 3 ; git rev-list -3 HEAD ; echo junk ; } | ~/src/git/git commit-graph write --stdin-commits error: unexpected non-hex object ID: junk Collecting commits from input: 3, done. Move that stop_progress() call to the right place. While at it, drop the unnecessary 'if (progress)' condition protecting the stop_progress() call, because that function is prepared to handle a NULL progress struct. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/commit-graph.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 75455da..796954d 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -251,7 +251,7 @@ static int graph_write(int argc, const char **argv)
}
}
-
+ stop_progress(&progress);
}
if (write_commit_graph(odb,
@@ -264,8 +264,6 @@ static int graph_write(int argc, const char **argv)
cleanup:
string_list_clear(&pack_indexes, 0);
strbuf_release(&buf);
- if (progress)
- stop_progress(&progress);
return result;
}