Skip to content

Commit 3b4d29f

Browse files
committed
A baseline test for the noop negotiator
1 parent 5e9659c commit 3b4d29f

File tree

5 files changed

+95
-0
lines changed

5 files changed

+95
-0
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-negotiate/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ gix-hash = { version = "^0.11.1", path = "../gix-hash" }
1717
gix-object = { version = "^0.29.2", path = "../gix-object" }
1818
gix-commitgraph = { version = "^0.15.0", path = "../gix-commitgraph" }
1919
gix-revision = { version = "^0.14.0", path = "../gix-revision" }
20+
21+
[dev-dependencies]
22+
gix-testtools = { path = "../tests/tools" }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:6c75bf41bf8b98eec86b6876fd2129d4194232795fd1bc9f315a26cda2efa2c6
3+
size 18356
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
set -eu -o pipefail
3+
4+
function tick () {
5+
if test -z "${tick+set}"
6+
then
7+
tick=1112911993
8+
else
9+
tick=$(($tick + 60))
10+
fi
11+
GIT_COMMITTER_DATE="$tick -0700"
12+
GIT_AUTHOR_DATE="$tick -0700"
13+
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
14+
}
15+
16+
tick
17+
function commit() {
18+
local message=${1:?first argument is the commit message}
19+
local file="$message.t"
20+
echo "$1" > "$file"
21+
git add -- "$file"
22+
git commit -m "$message"
23+
git tag "$message"
24+
tick
25+
}
26+
27+
function negotiation_tips () {
28+
local tips=""
29+
for arg in "$@"; do
30+
tips+=" --negotiation-tip=$arg"
31+
done
32+
echo "$tips"
33+
}
34+
35+
function trace_fetch_baseline () {
36+
for algo in noop consecutive skipping; do
37+
GIT_TRACE_PACKET="$PWD/baseline.$algo" \
38+
git -C client -c fetch.negotiationAlgorithm="$algo" fetch --negotiate-only $(negotiation_tips "$@") \
39+
--upload-pack 'unset GIT_TRACE_PACKET; git-upload-pack' \
40+
file://$PWD/server || :
41+
done
42+
}
43+
44+
45+
(mkdir no_parents && cd no_parents
46+
(git init -q server && cd server
47+
commit to_fetch
48+
)
49+
50+
(git init -q client && cd client
51+
for i in $(seq 7); do
52+
commit c$i
53+
done
54+
)
55+
56+
trace_fetch_baseline main
57+
)
58+
59+
(mkdir two_colliding_skips && cd two_colliding_skips
60+
(git init -q server && cd server
61+
commit to_fetch
62+
)
63+
64+
(git init -q client && cd client
65+
for i in $(seq 11); do
66+
commit c$i
67+
done
68+
git checkout c5
69+
commit c5side
70+
)
71+
72+
trace_fetch_baseline HEAD main
73+
)

gix-negotiate/tests/negotiate.rs

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use gix_testtools::Result;
2+
13
mod window_size {
24
use gix_negotiate::window_size;
35

@@ -31,3 +33,16 @@ mod window_size {
3133
}
3234
}
3335
}
36+
37+
mod baseline {
38+
use std::path::PathBuf;
39+
40+
#[test]
41+
fn run() {
42+
let _base = case_dir("no_parents");
43+
}
44+
45+
fn case_dir(name: &str) -> crate::Result<PathBuf> {
46+
Ok(gix_testtools::scripted_fixture_read_only("make_repos.sh")?.join(name))
47+
}
48+
}

0 commit comments

Comments
 (0)