Skip to content

Commit f9e31f2

Browse files
committed
first test can instantiate an Index on the new fixture (#16)
Note that the remote-check has been removed to support all kinds of indices. Change-checks will fail later should it not be in the correct format or an unrelated repo, so it should be fine.
1 parent 9a2ce43 commit f9e31f2

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

src/index/init.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,6 @@ impl Index {
7575
}
7676
})?;
7777

78-
if repo_did_exist {
79-
let remote = repo.find_remote("origin")?;
80-
let actual_remote_url = remote.url().ok_or_else(|| {
81-
git2::Error::from_str("did not obtain URL of remote named 'origin'")
82-
})?;
83-
if actual_remote_url != repository_url {
84-
return Err(git2::Error::from_str(&format!(
85-
"Actual 'origin' remote url {:#?} did not match desired one at {:#?}",
86-
actual_remote_url, repository_url
87-
)));
88-
}
89-
}
90-
9178
Ok(Index {
9279
repo,
9380
seen_ref_name: LAST_SEEN_REFNAME,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:77d8b1e3bd00d2ca3f136362a84f0a76bbefa8dc988e74287fae3bc50f949898
3+
size 855244

tests/fixtures/make-index-from-parts.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ set -eu -o pipefail
55
parts="${1:?first argument is the repoitory root}/tests/fixtures/index-parts"
66
commit_list=$parts/commit.list
77

8-
git init
9-
tar -x < $parts/init.*.tar
10-
git add . && git commit -m "initial commit"
8+
mkdir worktree
9+
(cd worktree
10+
git init
11+
tar -x < $parts/init.*.tar
12+
git add . && git commit -m "initial commit"
1113

1214

13-
while read -r commit; do
14-
patch -p1 < "$parts/$commit.diff"
15-
git add .
16-
git commit -F "$parts/$commit.msg"
17-
done < "$commit_list"
18-
git gc
15+
while read -r commit; do
16+
patch -p1 < "$parts/$commit.diff"
17+
git add .
18+
git commit -F "$parts/$commit.msg"
19+
done < "$commit_list"
20+
git gc
21+
)
22+
23+
git clone --bare --no-local ./worktree base
24+
git clone --bare ./worktree clone

tests/index/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ fn index_ro() -> Index {
1818
.map(|p| p.to_str().unwrap().to_owned()),
1919
)
2020
.unwrap();
21-
Index::from_path_or_cloned(dir).unwrap()
21+
Index::from_path_or_cloned(dir.join("base")).unwrap()
2222
}

0 commit comments

Comments
 (0)