History

[commitgraph] implement basic, low-level read API

This is just the first pass at ensuring we can read commit-graph files correctly. It does not support anything interesting like reachability, merge-base, or ahead-behind queries.

Conor Davis committed 6 years ago

Commit d1f0e9c1 parent 1b42b3153 files · +1429 −-23Browse files

Showing the changes to git-commitgraph/tests (43 of 53 files). Show all

Unified · Split

43 files
  1. git-commitgraph/tests/access/mod.rs +4 −0
  2. git-commitgraph/tests/access/octopus_merges.rs +140 −0
  3. git-commitgraph/tests/access/single_commit.rs +26 −0
  4. git-commitgraph/tests/access/single_parent.rs +44 −0
  5. git-commitgraph/tests/access/two_parents.rs +65 −0
  6. git-commitgraph/tests/commitgraph.rs +12 −0
  7. git-commitgraph/tests/fixtures/create_fixtures.sh +34 −0
  8. git-commitgraph/tests/fixtures/octopus_merges.sh +37 −0
  9. git-commitgraph/tests/fixtures/single_commit.sh +21 −0
  10. git-commitgraph/tests/fixtures/single_parent.sh +22 −0
  11. git-commitgraph/tests/fixtures/split_chain.sh +25 −0
  12. git-commitgraph/tests/fixtures/two_parents.sh +25 −0
  13. git-commitgraph/tests/fixtures/v1/bloom/info/commit-graph +0 −0
  14. git-commitgraph/tests/fixtures/v1/bloom/info/packs +2 −0
  15. git-commitgraph/tests/fixtures/v1/bloom/pack/pack-317d17c824d1a0b6991949219f7b6ba9ad51c3e6.idx +0 −0
  16. git-commitgraph/tests/fixtures/v1/bloom/pack/pack-317d17c824d1a0b6991949219f7b6ba9ad51c3e6.pack +0 −0
  17. git-commitgraph/tests/fixtures/v1/bloom_too_large/info/commit-graph +0 −0
  18. git-commitgraph/tests/fixtures/v1/bloom_too_large/info/packs +2 −0
  19. git-commitgraph/tests/fixtures/v1/bloom_too_large/pack/pack-b7a28066d2c1e9511d1a60349d0d6e3bf803d1b6.idx +0 −0
  20. git-commitgraph/tests/fixtures/v1/bloom_too_large/pack/pack-b7a28066d2c1e9511d1a60349d0d6e3bf803d1b6.pack +0 −0
  21. git-commitgraph/tests/fixtures/v1/octopus_merges/info/commit-graph +0 −0
  22. git-commitgraph/tests/fixtures/v1/octopus_merges/info/packs +2 −0
  23. git-commitgraph/tests/fixtures/v1/octopus_merges/pack/pack-976438ba1bde7d9c944d8681cbfad266feec7068.idx +0 −0
  24. git-commitgraph/tests/fixtures/v1/octopus_merges/pack/pack-976438ba1bde7d9c944d8681cbfad266feec7068.pack +0 −0
  25. git-commitgraph/tests/fixtures/v1/single_commit/info/commit-graph +0 −0
  26. git-commitgraph/tests/fixtures/v1/single_commit/info/packs +2 −0
  27. git-commitgraph/tests/fixtures/v1/single_commit/pack/pack-07779428eae7661b1471110dda1efc99e3e954e7.idx +0 −0
  28. git-commitgraph/tests/fixtures/v1/single_commit/pack/pack-07779428eae7661b1471110dda1efc99e3e954e7.pack +0 −0
  29. git-commitgraph/tests/fixtures/v1/single_parent/info/commit-graph +0 −0
  30. git-commitgraph/tests/fixtures/v1/single_parent/info/packs +2 −0
  31. git-commitgraph/tests/fixtures/v1/single_parent/pack/pack-ba89c2e6239315806e37d189aebf4a582e96a6d5.idx +0 −0
  32. git-commitgraph/tests/fixtures/v1/single_parent/pack/pack-ba89c2e6239315806e37d189aebf4a582e96a6d5.pack +0 −0
  33. git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/commit-graph-chain +3 −0
  34. git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/graph-422d4c835a8a22a401b80f8a76f0fa0be550db1b.graph +0 −0
  35. git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/graph-ca9f15bcd6129d304e0f4d4c8c6545467dcc78e1.graph +0 −0
  36. git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/graph-eda6e3e68ac22be2ae8191ed2c80113e7f0344c6.graph +0 −0
  37. git-commitgraph/tests/fixtures/v1/split_chain/info/packs +2 −0
  38. git-commitgraph/tests/fixtures/v1/split_chain/pack/pack-35e0a0e2cb2913c7990d1c6a6aa4747d9b3b5306.idx +0 −0
  39. git-commitgraph/tests/fixtures/v1/split_chain/pack/pack-35e0a0e2cb2913c7990d1c6a6aa4747d9b3b5306.pack +0 −0
  40. git-commitgraph/tests/fixtures/v1/two_parents/info/commit-graph +0 −0
  41. git-commitgraph/tests/fixtures/v1/two_parents/info/packs +2 −0
  42. git-commitgraph/tests/fixtures/v1/two_parents/pack/pack-ca696e967b89b66c96f70bcb9d9e8bba42417bcc.idx +0 −0
  43. git-commitgraph/tests/fixtures/v1/two_parents/pack/pack-ca696e967b89b66c96f70bcb9d9e8bba42417bcc.pack +0 −0
git-commitgraph/tests/access/mod.rs+4−0
@@ -0,0 +1,4 @@
1+mod octopus_merges;
2+mod single_commit;
3+mod single_parent;
4+mod two_parents;
git-commitgraph/tests/access/octopus_merges.rs+140−0
@@ -0,0 +1,140 @@
1+use crate::{fixture_path, hex_to_id};
2+use git_commitgraph::{Graph, GraphPosition};
3+
4+const ROOT: &[u8] = b"09e3185550fdb352031df65f0e81e74df3b9a556";
5+const ROOT_INDEX: GraphPosition = GraphPosition(0);
6+const COMMIT1: &[u8] = b"33316871b4ab988ea87ba60aaf0138ddb4fb0d21";
7+const COMMIT1_INDEX: GraphPosition = GraphPosition(2);
8+const COMMIT2: &[u8] = b"cbfe147d1826a0d2701f7c80dbe0e2cfba385b15";
9+const COMMIT2_INDEX: GraphPosition = GraphPosition(6);
10+const COMMIT3: &[u8] = b"9dab5d610702ceca4bd889a5ef2662cacfd53178";
11+const COMMIT3_INDEX: GraphPosition = GraphPosition(5);
12+const COMMIT4: &[u8] = b"2ec748404455c0b0451b186851a815da13918ebb";
13+const COMMIT4_INDEX: GraphPosition = GraphPosition(1);
14+const THREE_PARENTS: &[u8] = b"7070cd0b59cd46a0f0fa0c50ca9148390ae1e7c7";
15+const THREE_PARENTS_INDEX: GraphPosition = GraphPosition(4);
16+const FOUR_PARENTS: &[u8] = b"5ca46a72d91817add3a7218f3eaf8b2b6c1caa13";
17+const FOUR_PARENTS_INDEX: GraphPosition = GraphPosition(3);
18+
19+#[test]
20+fn v1() -> Result<(), Box<dyn std::error::Error>> {
21+ let root_id = hex_to_id(ROOT);
22+ let commit1_id = hex_to_id(COMMIT1);
23+ let commit2_id = hex_to_id(COMMIT2);
24+ let commit3_id = hex_to_id(COMMIT3);
25+ let commit4_id = hex_to_id(COMMIT4);
26+ let three_parents_id = hex_to_id(THREE_PARENTS);
27+ let four_parents_id = hex_to_id(FOUR_PARENTS);
28+
29+ let cg = Graph::from_object_dir(fixture_path("v1/octopus_merges"))?;
30+ assert_eq!(cg.num_commits(), 7);
31+ assert_eq!(cg.id_at(ROOT_INDEX), root_id.to_borrowed());
32+ assert_eq!(cg.id_at(COMMIT1_INDEX), commit1_id.to_borrowed());
33+ assert_eq!(cg.id_at(COMMIT2_INDEX), commit2_id.to_borrowed());
34+ assert_eq!(cg.id_at(COMMIT3_INDEX), commit3_id.to_borrowed());
35+ assert_eq!(cg.id_at(COMMIT4_INDEX), commit4_id.to_borrowed());
36+ assert_eq!(cg.id_at(THREE_PARENTS_INDEX), three_parents_id.to_borrowed());
37+ assert_eq!(cg.id_at(FOUR_PARENTS_INDEX), four_parents_id.to_borrowed());
38+ assert_eq!(
39+ cg.iter_ids().collect::<Vec<_>>(),
40+ vec![
41+ root_id.to_borrowed(),
42+ commit4_id.to_borrowed(),
43+ commit1_id.to_borrowed(),
44+ four_parents_id.to_borrowed(),
45+ three_parents_id.to_borrowed(),
46+ commit3_id.to_borrowed(),
47+ commit2_id.to_borrowed(),
48+ ]
49+ );
50+
51+ let root = cg.commit_at(ROOT_INDEX);
52+ assert_eq!(root.generation(), 1);
53+ assert_eq!(root.id(), root_id.to_borrowed());
54+ assert_eq!(root.parent1()?, None);
55+ assert_eq!(
56+ root.root_tree_id(),
57+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
58+ );
59+ assert_eq!(root.iter_parent_indices().collect::<Result<Vec<_>, _>>()?, vec![]);
60+
61+ let commit1 = cg.commit_at(COMMIT1_INDEX);
62+ assert_eq!(commit1.generation(), 2);
63+ assert_eq!(commit1.id(), commit1_id.to_borrowed());
64+ assert_eq!(commit1.parent1()?, Some(ROOT_INDEX));
65+ assert_eq!(
66+ commit1.root_tree_id(),
67+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
68+ );
69+ assert_eq!(
70+ commit1.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
71+ vec![ROOT_INDEX],
72+ );
73+
74+ let commit2 = cg.commit_at(COMMIT2_INDEX);
75+ assert_eq!(commit2.generation(), 2);
76+ assert_eq!(commit2.id(), commit2_id.to_borrowed());
77+ assert_eq!(commit2.parent1()?, Some(ROOT_INDEX));
78+ assert_eq!(
79+ commit2.root_tree_id(),
80+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
81+ );
82+ assert_eq!(
83+ commit2.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
84+ vec![ROOT_INDEX],
85+ );
86+
87+ let commit3 = cg.commit_at(COMMIT3_INDEX);
88+ assert_eq!(commit3.generation(), 2);
89+ assert_eq!(commit3.id(), commit3_id.to_borrowed());
90+ assert_eq!(commit3.parent1()?, Some(ROOT_INDEX));
91+ assert_eq!(
92+ commit3.root_tree_id(),
93+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
94+ );
95+ assert_eq!(
96+ commit3.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
97+ vec![ROOT_INDEX],
98+ );
99+
100+ let commit4 = cg.commit_at(COMMIT4_INDEX);
101+ assert_eq!(commit4.generation(), 2);
102+ assert_eq!(commit4.id(), commit4_id.to_borrowed());
103+ assert_eq!(commit4.parent1()?, Some(ROOT_INDEX));
104+ assert_eq!(
105+ commit4.root_tree_id(),
106+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
107+ );
108+ assert_eq!(
109+ commit4.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
110+ vec![ROOT_INDEX],
111+ );
112+
113+ let three_parents = cg.commit_at(THREE_PARENTS_INDEX);
114+ assert_eq!(three_parents.generation(), 3);
115+ assert_eq!(three_parents.id(), three_parents_id.to_borrowed());
116+ assert_eq!(three_parents.parent1()?, Some(COMMIT1_INDEX));
117+ assert_eq!(
118+ three_parents.root_tree_id(),
119+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
120+ );
121+ assert_eq!(
122+ three_parents.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
123+ vec![COMMIT1_INDEX, COMMIT2_INDEX, COMMIT3_INDEX],
124+ );
125+
126+ let four_parents = cg.commit_at(FOUR_PARENTS_INDEX);
127+ assert_eq!(four_parents.generation(), 3);
128+ assert_eq!(four_parents.id(), four_parents_id.to_borrowed());
129+ assert_eq!(four_parents.parent1()?, Some(COMMIT2_INDEX));
130+ assert_eq!(
131+ four_parents.root_tree_id(),
132+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
133+ );
134+ assert_eq!(
135+ four_parents.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
136+ vec![COMMIT2_INDEX, COMMIT1_INDEX, COMMIT3_INDEX, COMMIT4_INDEX],
137+ );
138+
139+ Ok(())
140+}
git-commitgraph/tests/access/single_commit.rs+26−0
@@ -0,0 +1,26 @@
1+use crate::{fixture_path, hex_to_id};
2+use git_commitgraph::{Graph, GraphPosition};
3+
4+const COMMIT: &[u8] = b"771fa42310bb3d221f4cf82613a491b0957d2003";
5+
6+#[test]
7+fn v1() -> Result<(), Box<dyn std::error::Error>> {
8+ let commit_id = hex_to_id(COMMIT);
9+
10+ let cg = Graph::from_object_dir(fixture_path("v1/single_commit"))?;
11+ assert_eq!(cg.num_commits(), 1);
12+ assert_eq!(cg.id_at(GraphPosition(0)), commit_id.to_borrowed());
13+ assert_eq!(cg.iter_ids().collect::<Vec<_>>(), vec![commit_id.to_borrowed()]);
14+
15+ let commit = cg.commit_at(GraphPosition(0));
16+ assert_eq!(commit.generation(), 1);
17+ assert_eq!(commit.id(), commit_id.to_borrowed());
18+ assert_eq!(commit.parent1()?, None);
19+ assert_eq!(
20+ commit.root_tree_id(),
21+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
22+ );
23+ assert_eq!(commit.iter_parent_indices().collect::<Result<Vec<_>, _>>()?, vec![]);
24+
25+ Ok(())
26+}
git-commitgraph/tests/access/single_parent.rs+44−0
@@ -0,0 +1,44 @@
1+use crate::{fixture_path, hex_to_id};
2+use git_commitgraph::{Graph, GraphPosition};
3+
4+const PARENT: &[u8] = b"ddbbe1220676705c5b7a6bb7047e0d63b58cfc28";
5+const CHILD: &[u8] = b"91bfe17bfdfef01c4c38e34e577b01a14a1ef2d4";
6+
7+#[test]
8+fn v1() -> Result<(), Box<dyn std::error::Error>> {
9+ let parent_id = hex_to_id(PARENT);
10+ let child_id = hex_to_id(CHILD);
11+
12+ let cg = Graph::from_object_dir(fixture_path("v1/single_parent"))?;
13+ assert_eq!(cg.num_commits(), 2);
14+ assert_eq!(cg.id_at(GraphPosition(0)), child_id.to_borrowed());
15+ assert_eq!(
16+ cg.iter_ids().collect::<Vec<_>>(),
17+ vec![child_id.to_borrowed(), parent_id.to_borrowed()]
18+ );
19+
20+ let parent = cg.commit_at(GraphPosition(1));
21+ assert_eq!(parent.generation(), 1);
22+ assert_eq!(parent.id(), parent_id.to_borrowed());
23+ assert_eq!(parent.parent1()?, None);
24+ assert_eq!(
25+ parent.root_tree_id(),
26+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
27+ );
28+ assert_eq!(parent.iter_parent_indices().collect::<Result<Vec<_>, _>>()?, vec![]);
29+
30+ let child = cg.commit_at(GraphPosition(0));
31+ assert_eq!(child.generation(), 2);
32+ assert_eq!(child.id(), child_id.to_borrowed());
33+ assert_eq!(child.parent1()?, Some(GraphPosition(1)));
34+ assert_eq!(
35+ child.root_tree_id(),
36+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
37+ );
38+ assert_eq!(
39+ child.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
40+ vec![GraphPosition(1)]
41+ );
42+
43+ Ok(())
44+}
git-commitgraph/tests/access/two_parents.rs+65−0
@@ -0,0 +1,65 @@
1+use crate::{fixture_path, hex_to_id};
2+use git_commitgraph::{Graph, GraphPosition};
3+
4+const PARENT1: &[u8] = b"7506a95b8062f0bee6ccdee717021a0c710a1959";
5+const PARENT1_INDEX: GraphPosition = GraphPosition(2);
6+const PARENT2: &[u8] = b"12ae061ac737392973e59d5df2103a72f1088e45";
7+const PARENT2_INDEX: GraphPosition = GraphPosition(0);
8+const MERGE: &[u8] = b"6a23d4bb5ef62fff1b57b898240bf5a9d5813800";
9+const MERGE_INDEX: GraphPosition = GraphPosition(1);
10+
11+#[test]
12+fn v1() -> Result<(), Box<dyn std::error::Error>> {
13+ let parent1_id = hex_to_id(PARENT1);
14+ let parent2_id = hex_to_id(PARENT2);
15+ let merge_id = hex_to_id(MERGE);
16+
17+ let cg = Graph::from_object_dir(fixture_path("v1/two_parents"))?;
18+ assert_eq!(cg.num_commits(), 3);
19+ assert_eq!(cg.id_at(PARENT1_INDEX), parent1_id.to_borrowed());
20+ assert_eq!(cg.id_at(PARENT2_INDEX), parent2_id.to_borrowed());
21+ assert_eq!(cg.id_at(MERGE_INDEX), merge_id.to_borrowed());
22+ assert_eq!(
23+ cg.iter_ids().collect::<Vec<_>>(),
24+ vec![
25+ parent2_id.to_borrowed(),
26+ merge_id.to_borrowed(),
27+ parent1_id.to_borrowed()
28+ ]
29+ );
30+
31+ let parent1 = cg.commit_at(PARENT1_INDEX);
32+ assert_eq!(parent1.generation(), 1);
33+ assert_eq!(parent1.id(), parent1_id.to_borrowed());
34+ assert_eq!(parent1.parent1()?, None);
35+ assert_eq!(
36+ parent1.root_tree_id(),
37+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
38+ );
39+ assert_eq!(parent1.iter_parent_indices().collect::<Result<Vec<_>, _>>()?, vec![]);
40+
41+ let parent2 = cg.commit_at(PARENT2_INDEX);
42+ assert_eq!(parent2.generation(), 1);
43+ assert_eq!(parent2.id(), parent2_id.to_borrowed());
44+ assert_eq!(parent2.parent1()?, None);
45+ assert_eq!(
46+ parent2.root_tree_id(),
47+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
48+ );
49+ assert_eq!(parent2.iter_parent_indices().collect::<Result<Vec<_>, _>>()?, vec![]);
50+
51+ let merge = cg.commit_at(MERGE_INDEX);
52+ assert_eq!(merge.generation(), 2);
53+ assert_eq!(merge.id(), merge_id.to_borrowed());
54+ assert_eq!(merge.parent1()?, Some(PARENT1_INDEX));
55+ assert_eq!(
56+ merge.root_tree_id(),
57+ hex_to_id(b"4b825dc642cb6eb9a060e54bf8d69288fbee4904").to_borrowed(),
58+ );
59+ assert_eq!(
60+ merge.iter_parent_indices().collect::<Result<Vec<_>, _>>()?,
61+ vec![PARENT1_INDEX, PARENT2_INDEX]
62+ );
63+
64+ Ok(())
65+}
git-commitgraph/tests/commitgraph.rs+12−0
@@ -0,0 +1,12 @@
1+use git_object::owned;
2+use std::path::PathBuf;
3+
4+mod access;
5+
6+pub fn fixture_path(path: &str) -> PathBuf {
7+ PathBuf::from("tests").join("fixtures").join(path)
8+}
9+
10+pub fn hex_to_id(hex: &[u8]) -> owned::Id {
11+ owned::Id::from_40_bytes_in_hex(hex).expect("40 bytes hex")
12+}
git-commitgraph/tests/fixtures/create_fixtures.sh+34−0
@@ -0,0 +1,34 @@
1+#!/bin/bash
2+set -eu -o pipefail
3+
4+parent_dir="$1"
5+mkdir "$parent_dir"
6+
7+script_dir=$(dirname "$(realpath -e "$0")")
8+
9+run() {
10+ local target_dir=$parent_dir/$1
11+ local script=$script_dir/$1.sh
12+
13+ local temp_dir=$(mktemp -d create_fixtures-XXXXXXXXXX)
14+ trap "rm -rf $temp_dir" EXIT
15+ "$script" "$temp_dir"
16+ cp -dR "$temp_dir/.git/objects/" "$target_dir/"
17+ rm -rf "$temp_dir"
18+ trap - EXIT
19+}
20+
21+run bloom
22+run bloom_too_large
23+run octopus_merges
24+run single_commit
25+run single_parent
26+run split_chain
27+run two_parents
28+
29+#"$script_dir"/bloom.sh "$parent_dir/bloom"
30+#"$script_dir"/bloom_too_large.sh "$parent_dir/bloom_to_large"
31+#"$script_dir"/octopus_merges.sh "$parent_dir/octopus_merges"
32+#"$script_dir"/single_commit.sh "$parent_dir/single_commit"
33+#"$script_dir"/single_parent.sh "$parent_dir/single_parent"
34+#"$script_dir"/two_parents.sh "$parent_dir/two_parents"
git-commitgraph/tests/fixtures/octopus_merges.sh+37−0
@@ -0,0 +1,37 @@
1+#!/bin/bash
2+set -eu -o pipefail
3+
4+export GIT_AUTHOR_DATE="2000-01-01 00:00:00 +0000"
5+export GIT_AUTHOR_EMAIL=author@example.com
6+export GIT_AUTHOR_NAME=author
7+export GIT_COMMITTER_DATE="2000-01-02 00:00:00 +0000"
8+export GIT_COMMITTER_EMAIL=committer@example.com
9+export GIT_COMMITTER_NAME=committer
10+
11+mkdir -p "$1"
12+cd "$1"
13+git init -q
14+
15+git checkout -q --orphan root
16+git commit -q --allow-empty -m root
17+
18+git checkout -q -b commit1 root
19+git commit -q --allow-empty -m commit1
20+
21+git checkout -q -b commit2 root
22+git commit -q --allow-empty -m commit2
23+
24+git checkout -q -b commit3 root
25+git commit -q --allow-empty -m commit3
26+
27+git checkout -q -b commit4 root
28+git commit -q --allow-empty -m commit4
29+
30+git checkout -q -b three_parents commit1
31+git merge -q -m three_parents --no-ff commit2 commit3 >/dev/null
32+
33+git checkout -q -b four_parents commit2
34+git merge -q -m four_parents --no-ff commit1 commit3 commit4 >/dev/null
35+
36+git commit-graph write --no-progress --reachable
37+git repack -adq
git-commitgraph/tests/fixtures/single_commit.sh+21−0
@@ -0,0 +1,21 @@
1+#!/bin/bash
2+set -eu -o pipefail
3+
4+# The goal with this repo is to have the smallest commit-graph file possible, in the hopes that an
5+# off-by-one error
6+export GIT_AUTHOR_DATE="2000-01-01 00:00:00 +0000"
7+export GIT_AUTHOR_EMAIL=author@example.com
8+export GIT_AUTHOR_NAME=author
9+export GIT_COMMITTER_DATE="2000-01-02 00:00:00 +0000"
10+export GIT_COMMITTER_EMAIL=committer@example.com
11+export GIT_COMMITTER_NAME=committer
12+
13+mkdir -p "$1"
14+cd "$1"
15+git init -q
16+
17+git checkout -q -b commit
18+git commit -q --allow-empty -m commit
19+
20+git commit-graph write --no-progress --reachable
21+git repack -adq
git-commitgraph/tests/fixtures/single_parent.sh+22−0
@@ -0,0 +1,22 @@
1+#!/bin/bash
2+set -eu -o pipefail
3+
4+export GIT_AUTHOR_DATE="2000-01-01 00:00:00 +0000"
5+export GIT_AUTHOR_EMAIL=author@example.com
6+export GIT_AUTHOR_NAME=author
7+export GIT_COMMITTER_DATE="2000-01-02 00:00:00 +0000"
8+export GIT_COMMITTER_EMAIL=committer@example.com
9+export GIT_COMMITTER_NAME=committer
10+
11+mkdir -p "$1"
12+cd "$1"
13+git init -q
14+
15+git checkout -q -b parent
16+git commit -q --allow-empty -m parent
17+
18+git checkout -q -b child parent
19+git commit -q --allow-empty -m child
20+
21+git commit-graph write --no-progress --reachable
22+git repack -adq
git-commitgraph/tests/fixtures/split_chain.sh+25−0
@@ -0,0 +1,25 @@
1+#!/bin/bash
2+set -eu -o pipefail
3+
4+export GIT_AUTHOR_DATE="2000-01-01 00:00:00 +0000"
5+export GIT_AUTHOR_EMAIL=author@example.com
6+export GIT_AUTHOR_NAME=author
7+export GIT_COMMITTER_DATE="2000-01-02 00:00:00 +0000"
8+export GIT_COMMITTER_EMAIL=committer@example.com
9+export GIT_COMMITTER_NAME=committer
10+
11+mkdir -p "$1"
12+cd "$1"
13+git init -q
14+
15+git checkout -q -b commit1
16+git commit -q --allow-empty -m commit1
17+git checkout -q -b commit2 commit1
18+git commit -q --allow-empty -m commit2
19+git checkout -q -b commit3 commit2
20+git commit -q --allow-empty -m commit3
21+
22+git show-ref -s commit1 | git commit-graph write --no-progress --split=no-merge --stdin-commits
23+git show-ref -s commit2 | git commit-graph write --no-progress --split=no-merge --stdin-commits
24+git show-ref -s commit3 | git commit-graph write --no-progress --split=no-merge --stdin-commits
25+git repack -adq
git-commitgraph/tests/fixtures/two_parents.sh+25−0
@@ -0,0 +1,25 @@
1+#!/bin/bash
2+set -eu -o pipefail
3+
4+export GIT_AUTHOR_DATE="2000-01-01 00:00:00 +0000"
5+export GIT_AUTHOR_EMAIL=author@example.com
6+export GIT_AUTHOR_NAME=author
7+export GIT_COMMITTER_DATE="2000-01-02 00:00:00 +0000"
8+export GIT_COMMITTER_EMAIL=committer@example.com
9+export GIT_COMMITTER_NAME=committer
10+
11+mkdir -p "$1"
12+cd "$1"
13+git init -q
14+
15+git checkout -q --orphan parent1
16+git commit -q --allow-empty -m parent1
17+
18+git checkout -q --orphan parent2
19+git commit -q --allow-empty -m parent2
20+
21+git checkout -q -b merge parent1
22+git merge -q --allow-unrelated-histories --no-ff -m merge parent2 >/dev/null
23+
24+git commit-graph write --no-progress --reachable
25+git repack -adq
git-commitgraph/tests/fixtures/v1/bloom/info/commit-graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/bloom/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-317d17c824d1a0b6991949219f7b6ba9ad51c3e6.pack
2+
git-commitgraph/tests/fixtures/v1/bloom/pack/pack-317d17c824d1a0b6991949219f7b6ba9ad51c3e6.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/bloom/pack/pack-317d17c824d1a0b6991949219f7b6ba9ad51c3e6.pack+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/bloom_too_large/info/commit-graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/bloom_too_large/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-b7a28066d2c1e9511d1a60349d0d6e3bf803d1b6.pack
2+
git-commitgraph/tests/fixtures/v1/bloom_too_large/pack/pack-b7a28066d2c1e9511d1a60349d0d6e3bf803d1b6.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/bloom_too_large/pack/pack-b7a28066d2c1e9511d1a60349d0d6e3bf803d1b6.pack+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/octopus_merges/info/commit-graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/octopus_merges/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-976438ba1bde7d9c944d8681cbfad266feec7068.pack
2+
git-commitgraph/tests/fixtures/v1/octopus_merges/pack/pack-976438ba1bde7d9c944d8681cbfad266feec7068.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/octopus_merges/pack/pack-976438ba1bde7d9c944d8681cbfad266feec7068.pack+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/single_commit/info/commit-graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/single_commit/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-07779428eae7661b1471110dda1efc99e3e954e7.pack
2+
git-commitgraph/tests/fixtures/v1/single_commit/pack/pack-07779428eae7661b1471110dda1efc99e3e954e7.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/single_commit/pack/pack-07779428eae7661b1471110dda1efc99e3e954e7.pack+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/single_parent/info/commit-graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/single_parent/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-ba89c2e6239315806e37d189aebf4a582e96a6d5.pack
2+
git-commitgraph/tests/fixtures/v1/single_parent/pack/pack-ba89c2e6239315806e37d189aebf4a582e96a6d5.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/single_parent/pack/pack-ba89c2e6239315806e37d189aebf4a582e96a6d5.pack+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/commit-graph-chain+3−0
@@ -0,0 +1,3 @@
1+ca9f15bcd6129d304e0f4d4c8c6545467dcc78e1
2+422d4c835a8a22a401b80f8a76f0fa0be550db1b
3+eda6e3e68ac22be2ae8191ed2c80113e7f0344c6
git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/graph-422d4c835a8a22a401b80f8a76f0fa0be550db1b.graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/graph-ca9f15bcd6129d304e0f4d4c8c6545467dcc78e1.graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/split_chain/info/commit-graphs/graph-eda6e3e68ac22be2ae8191ed2c80113e7f0344c6.graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/split_chain/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-35e0a0e2cb2913c7990d1c6a6aa4747d9b3b5306.pack
2+
git-commitgraph/tests/fixtures/v1/split_chain/pack/pack-35e0a0e2cb2913c7990d1c6a6aa4747d9b3b5306.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/split_chain/pack/pack-35e0a0e2cb2913c7990d1c6a6aa4747d9b3b5306.pack+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/two_parents/info/commit-graph+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/two_parents/info/packs+2−0
@@ -0,0 +1,2 @@
1+P pack-ca696e967b89b66c96f70bcb9d9e8bba42417bcc.pack
2+
git-commitgraph/tests/fixtures/v1/two_parents/pack/pack-ca696e967b89b66c96f70bcb9d9e8bba42417bcc.idx+0−0

Binary file not shown.

git-commitgraph/tests/fixtures/v1/two_parents/pack/pack-ca696e967b89b66c96f70bcb9d9e8bba42417bcc.pack+0−0

Binary file not shown.