summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Derrick Stolee <dstolee@microsoft.com>2019-06-18 11:14:36 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-06-19 20:46:27 -0700
commit5b15eb397d176c557a82e872d6b4043aa7589874 (patch)
tree5d1d20dac20bd054a53ed9c3a74e3a1f363e59c6
parentcommit-graph: normalize commit-graph filenames (diff)
downloadtgif-5b15eb397d176c557a82e872d6b4043aa7589874.tar.xz
commit-graph: test verify across alternates
The 'git commit-graph verify' subcommand loads a commit-graph from a given object directory instead of using the standard method prepare_commit_graph(). During development of load_commit_graph_chain(), a version did not include prepare_alt_odb() as it was previously run by prepare_commit_graph() in most cases. Add a test that prevents that mistake from happening again. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t5324-split-commit-graph.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index fc0d00751c..03f45a1ed9 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -237,6 +237,7 @@ corrupt_file() {
file=$1
pos=$2
data="${3:-\0}"
+ chmod a+w "$file" &&
printf "$data" | dd of="$file" bs=1 seek="$pos" conv=notrunc
}
@@ -295,6 +296,24 @@ test_expect_success 'verify after commit-graph-chain corruption' '
)
'
+test_expect_success 'verify across alternates' '
+ git clone --no-hardlinks . verify-alt &&
+ (
+ cd verify-alt &&
+ rm -rf $graphdir &&
+ altdir="$(pwd)/../.git/objects" &&
+ echo "$altdir" >.git/objects/info/alternates &&
+ git commit-graph verify --object-dir="$altdir/" &&
+ test_commit extra &&
+ git commit-graph write --reachable --split &&
+ tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
+ corrupt_file "$tip_file" 100 "\01" &&
+ test_must_fail git commit-graph verify --shallow 2>test_err &&
+ grep -v "^+" test_err >err &&
+ test_i18ngrep "commit-graph has incorrect fanout value" err
+ )
+'
+
test_expect_success 'add octopus merge' '
git reset --hard commits/10 &&
git merge commits/3 commits/4 &&