Skip to content

Commit

Permalink
test(cargo-update): verify a oid-like tag triggers a re-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jan 4, 2024
1 parent 093f7c8 commit e6f2dfd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,4 +1351,22 @@ fn update_precise_git_revisions() {

assert!(p.read_lockfile().contains(&tag_commit_id));
assert!(!p.read_lockfile().contains(&head_id));

// Now make a tag looks like an oid.
// It requires a git fetch, as the oid cannot be found in preexisting git db.
let arbitrary_tag: String = std::iter::repeat('a').take(head_id.len()).collect();
git::tag(&git_repo, &arbitrary_tag);

p.cargo("update git --precise")
.arg(&arbitrary_tag)
.with_stderr(format!(
"\
[UPDATING] git repository `{url}`
[UPDATING] git v0.5.0 ([..]) -> #{}",
&head_id[..8],
))
.run();

assert!(p.read_lockfile().contains(&head_id));
assert!(!p.read_lockfile().contains(&tag_commit_id));
}

0 comments on commit e6f2dfd

Please sign in to comment.