-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
272 additions
and
32 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src-tauri/yaak-git/permissions/autogenerated/commands/checkout_remote.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Automatically generated - DO NOT EDIT! | ||
|
||
"$schema" = "../../schemas/schema.json" | ||
|
||
[[permission]] | ||
identifier = "allow-checkout-remote" | ||
description = "Enables the checkout_remote command without any pre-configured scope." | ||
commands.allow = ["checkout_remote"] | ||
|
||
[[permission]] | ||
identifier = "deny-checkout-remote" | ||
description = "Denies the checkout_remote command without any pre-configured scope." | ||
commands.deny = ["checkout_remote"] |
13 changes: 13 additions & 0 deletions
13
src-tauri/yaak-git/permissions/autogenerated/commands/fetch_all.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Automatically generated - DO NOT EDIT! | ||
|
||
"$schema" = "../../schemas/schema.json" | ||
|
||
[[permission]] | ||
identifier = "allow-fetch-all" | ||
description = "Enables the fetch_all command without any pre-configured scope." | ||
commands.allow = ["fetch_all"] | ||
|
||
[[permission]] | ||
identifier = "deny-fetch-all" | ||
description = "Denies the fetch_all command without any pre-configured scope." | ||
commands.deny = ["fetch_all"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::callbacks::default_callbacks; | ||
use crate::error::Result; | ||
use crate::repository::open_repo; | ||
use git2::{FetchOptions, ProxyOptions, Repository}; | ||
use std::path::Path; | ||
|
||
pub(crate) fn git_fetch_all(dir: &Path) -> Result<()> { | ||
let repo = open_repo(dir)?; | ||
let remotes = repo.remotes()?.iter().flatten().map(String::from).collect::<Vec<_>>(); | ||
|
||
for (_idx, remote) in remotes.into_iter().enumerate() { | ||
fetch_from_remote(&repo, &remote)?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
fn fetch_from_remote(repo: &Repository, remote: &str) -> Result<()> { | ||
let mut remote = repo.find_remote(remote)?; | ||
|
||
let mut options = FetchOptions::new(); | ||
let callbacks = default_callbacks(); | ||
|
||
options.prune(git2::FetchPrune::On); | ||
let mut proxy = ProxyOptions::new(); | ||
proxy.auto(); | ||
|
||
options.proxy_options(proxy); | ||
options.download_tags(git2::AutotagOption::All); | ||
options.remote_callbacks(callbacks); | ||
|
||
remote.fetch(&[] as &[&str], Some(&mut options), None)?; | ||
// fetch tags (also removing remotely deleted ones) | ||
remote.fetch(&["refs/tags/*:refs/tags/*"], Some(&mut options), None)?; | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.