Skip to content

Commit e6f2dfd

Browse files
committed
test(cargo-update): verify a oid-like tag triggers a re-fetch
1 parent 093f7c8 commit e6f2dfd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: tests/testsuite/update.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1351,4 +1351,22 @@ fn update_precise_git_revisions() {
13511351

13521352
assert!(p.read_lockfile().contains(&tag_commit_id));
13531353
assert!(!p.read_lockfile().contains(&head_id));
1354+
1355+
// Now make a tag looks like an oid.
1356+
// It requires a git fetch, as the oid cannot be found in preexisting git db.
1357+
let arbitrary_tag: String = std::iter::repeat('a').take(head_id.len()).collect();
1358+
git::tag(&git_repo, &arbitrary_tag);
1359+
1360+
p.cargo("update git --precise")
1361+
.arg(&arbitrary_tag)
1362+
.with_stderr(format!(
1363+
"\
1364+
[UPDATING] git repository `{url}`
1365+
[UPDATING] git v0.5.0 ([..]) -> #{}",
1366+
&head_id[..8],
1367+
))
1368+
.run();
1369+
1370+
assert!(p.read_lockfile().contains(&head_id));
1371+
assert!(!p.read_lockfile().contains(&tag_commit_id));
13541372
}

0 commit comments

Comments
 (0)