git: don't fetch tags we're not fetching commits for

In the recent switch away from `git2::Remote::fetch()`, I passed
`git2::AutotagOption::All`, which caused cloning of e.g. the `clap`
repo to fail like this:

```
Error: Fetch failed: Error { code: -1, klass: 4, message: "target OID for the reference doesn't exist on the repository" }
```

This commit changes from `All` to `Unspecified`, which respects the
remote's configuration.
This commit is contained in:
Martin von Zweigbergk 2021-09-24 07:34:13 -07:00
parent d121cd7f75
commit edf7ec0a72

View file

@ -155,7 +155,12 @@ pub fn fetch(
callbacks.credentials(|_url, username_from_url, _allowed_types| {
git2::Cred::ssh_key_from_agent(username_from_url.unwrap())
});
remote.update_tips(Some(&mut callbacks), false, git2::AutotagOption::All, None)?;
remote.update_tips(
Some(&mut callbacks),
false,
git2::AutotagOption::Unspecified,
None,
)?;
// TODO: We could make it optional to get the default branch since we only care
// about it on clone.
let mut default_branch = None;