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:30 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-20 06:46:26 +0300
commitc523035cbd8515d095dc15e9661fd896733bedbc (patch)
tree8975475cc2db27ad56a35ecae5fbe974b040f607 /t/t5324-split-commit-graph.sh
parent1771be90c8e4797c2466296d1d570dbfa39d9743 (diff)
commit-graph: allow cross-alternate chains
In an environment like a fork network, it is helpful to have a commit-graph chain that spans both the base repo and the fork repo. The fork is usually a small set of data on top of the large repo, but sometimes the fork is much larger. For example, git-for-windows/git has almost double the number of commits as git/git because it rebases its commits on every major version update. To allow cross-alternate commit-graph chains, we need a few pieces: 1. When looking for a graph-{hash}.graph file, check all alternates. 2. When merging commit-graph chains, do not merge across alternates. 3. When writing a new commit-graph chain based on a commit-graph file in another object directory, do not allow success if the base file has of the name "commit-graph" instead of "commit-graphs/graph-{hash}.graph". Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5324-split-commit-graph.sh')
-rwxr-xr-xt/t5324-split-commit-graph.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index 5cb5663a30..46f0832f68 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -90,6 +90,21 @@ test_expect_success 'add more commits, and write a new base graph' '
graph_read_expect 12
'
+test_expect_success 'fork and fail to base a chain on a commit-graph file' '
+ test_when_finished rm -rf fork &&
+ git clone . fork &&
+ (
+ cd fork &&
+ rm .git/objects/info/commit-graph &&
+ echo "$(pwd)/../.git/objects" >.git/objects/info/alternates &&
+ test_commit new-commit &&
+ git commit-graph write --reachable --split &&
+ test_path_is_file $graphdir/commit-graph-chain &&
+ test_line_count = 1 $graphdir/commit-graph-chain &&
+ verify_chain_files_exist $graphdir
+ )
+'
+
test_expect_success 'add three more commits, write a tip graph' '
git reset --hard commits/3 &&
git merge merge/1 &&
@@ -132,4 +147,26 @@ test_expect_success 'add one commit, write a merged graph' '
graph_git_behavior 'merged commit-graph: commit 12 vs 6' commits/12 commits/6
+test_expect_success 'create fork and chain across alternate' '
+ git clone . fork &&
+ (
+ cd fork &&
+ git config core.commitGraph true &&
+ rm -rf $graphdir &&
+ echo "$(pwd)/../.git/objects" >.git/objects/info/alternates &&
+ test_commit 13 &&
+ git branch commits/13 &&
+ git commit-graph write --reachable --split &&
+ test_path_is_file $graphdir/commit-graph-chain &&
+ test_line_count = 3 $graphdir/commit-graph-chain &&
+ ls $graphdir/graph-*.graph >graph-files &&
+ test_line_count = 1 graph-files &&
+ git -c core.commitGraph=true rev-list HEAD >expect &&
+ git -c core.commitGraph=false rev-list HEAD >actual &&
+ test_cmp expect actual
+ )
+'
+
+graph_git_behavior 'alternate: commit 13 vs 6' commits/13 commits/6
+
test_done