Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-06-18 21:14:33 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-20 06:46:26 +0300
commitba41112a6331e8b454cac6cfd3ee67ae93957a2c (patch)
tree10fc409a0ff2b2cb88ee4c8809877e663175b3dd /commit-graph.c
parent3da4b609bb14b13672f64af908706462617f53cb (diff)
commit-graph: clean up chains after flattened write
If we write a commit-graph file without the split option, then we write to $OBJDIR/info/commit-graph and start to ignore the chains in $OBJDIR/info/commit-graphs/. Unlink the commit-graph-chain file and expire the graph-{hash}.graph files in $OBJDIR/info/commit-graphs/ during every write. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/commit-graph.c b/commit-graph.c
index f33f4fe009..3599ae664d 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1687,6 +1687,12 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
if (ctx->split_opts && ctx->split_opts->expire_time)
expire_time -= ctx->split_opts->expire_time;
+ if (!ctx->split) {
+ char *chain_file_name = get_chain_filename(ctx->obj_dir);
+ unlink(chain_file_name);
+ free(chain_file_name);
+ ctx->num_commit_graphs_after = 0;
+ }
strbuf_addstr(&path, ctx->obj_dir);
strbuf_addstr(&path, "/info/commit-graphs");
@@ -1841,10 +1847,10 @@ int write_commit_graph(const char *obj_dir,
res = write_commit_graph_file(ctx);
- if (ctx->split) {
+ if (ctx->split)
mark_commit_graphs(ctx);
- expire_commit_graphs(ctx);
- }
+
+ expire_commit_graphs(ctx);
cleanup:
free(ctx->graph_name);