Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to git2 0.15 #206

Merged
merged 1 commit into from
Sep 10, 2022
Merged

Upgrade to git2 0.15 #206

merged 1 commit into from
Sep 10, 2022

Conversation

abhinav
Copy link
Contributor

@abhinav abhinav commented Sep 9, 2022

Since 0.13, git2 has seen many changes, including rust-lang/git2-rs#791
which should address the extensions.worktreeConfig issue in #195.

The upgrade required fixing uses of ConfigEntries because it's no
longer an iterator.
However, it provides an API that lends itself well to a while let statement,
which provides a for-loop-like experience, so the fix was straightforward.

Since 0.13, a few changes have been made to git2, including
rust-lang/git2-rs#791 which should address the
extensions.worktreeConfig issue in #195.

The upgrade required fixing uses of [ConfigEntries][1] because it's no
longer an iterator.

[1]: https://docs.rs/git2/0.15.0/git2/struct.ConfigEntries.html

However, it provides an API that lends itself well to `while let`
to provide a for loop like experience, so this was an easy fix.
let entry = entry?;
if let Some(name) = entry.name() {
config_to_delete.push(name.to_string());
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, this extra { ... } is required to limit the lifetime of ConfigEntries so that config can be borrowed mutably again below for config.remove.

@jpgrayson jpgrayson merged commit 915f629 into stacked-git:master Sep 10, 2022
@jpgrayson
Copy link
Collaborator

Thanks, @abhinav! I'm a little embarrassed to not have noticed that StGit had gotten so behind on git2. I'm going to have up my cargo outdated game.

@abhinav
Copy link
Contributor Author

abhinav commented Sep 10, 2022

NP! Credit goes to @NonLogicalDev for finding out that this was fixed upstream.

Thanks, @abhinav! I'm a little embarrassed to not have noticed that StGit had gotten so behind on git2. I'm going to have up my cargo outdated game.

GitHub's dependabot supports Cargo, if that's something you're willing to use.
You can stick this in .github/dependabot.yml and it'll check for updates and make PRs at your chosen cadence.

version: 2
updates:
  - package-ecosystem: "cargo"
    directory: "/"
    schedule:
      interval: "weekly"

@abhinav abhinav mentioned this pull request Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants