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:28 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-20 06:46:26 +0300
commit135a7123755bfdde05da18012bebd2776f82b26c (patch)
tree97fcac3256d9ed879948db7255c13457828b2bdc /commit-graph.c
parent6c622f9f0bbb38a23341dc4294f56d0d909b3d50 (diff)
commit-graph: add --split option to builtin
Add a new "--split" option to the 'git commit-graph write' subcommand. This option allows the optional behavior of writing a commit-graph chain. The current behavior will add a tip commit-graph containing any commits that are not in the existing commit-graph or commit-graph chain. Later changes will allow merging the chain and expiring out-dated files. Add a new test script (t5324-split-commit-graph.sh) that demonstrates this behavior. Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> 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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/commit-graph.c b/commit-graph.c
index f0698b0599..1224309e5f 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1472,12 +1472,16 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
}
if (ctx->base_graph_name) {
- result = rename(ctx->base_graph_name,
- ctx->commit_graph_filenames_after[ctx->num_commit_graphs_after - 2]);
+ const char *dest = ctx->commit_graph_filenames_after[
+ ctx->num_commit_graphs_after - 2];
- if (result) {
- error(_("failed to rename base commit-graph file"));
- return -1;
+ if (strcmp(ctx->base_graph_name, dest)) {
+ result = rename(ctx->base_graph_name, dest);
+
+ if (result) {
+ error(_("failed to rename base commit-graph file"));
+ return -1;
+ }
}
} else {
char *graph_name = get_commit_graph_filename(ctx->obj_dir);