summaryrefslogtreecommitdiffstats
path: root/src/repo.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@noreply.codeberg.org>2024-12-09 03:11:04 +0100
committerCyborus <cyborus@noreply.codeberg.org>2024-12-09 03:11:04 +0100
commit08e9fa2dce45d4f87cf2c658ceca209c1011f039 (patch)
treea175843e9a8b0c47b33fc7eee6623eaf03c499b0 /src/repo.rs
parentMerge pull request 'fix: detaching when using `browse`' (#143) from dataCobra... (diff)
parentfeat: use `Repository::discover` to open local repo (diff)
downloadforgejo-cli-08e9fa2dce45d4f87cf2c658ceca209c1011f039.tar.xz
forgejo-cli-08e9fa2dce45d4f87cf2c658ceca209c1011f039.zip
Merge pull request 'use `Repository::discover` instead of `open`' (#144) from git-in-subdir into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/144
Diffstat (limited to 'src/repo.rs')
-rw-r--r--src/repo.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/repo.rs b/src/repo.rs
index 424470f..adfde12 100644
--- a/src/repo.rs
+++ b/src/repo.rs
@@ -78,7 +78,7 @@ impl RepoInfo {
let (remote_url, remote_repo_name) = {
let mut out = (None, None);
- if let Ok(local_repo) = git2::Repository::open(".") {
+ if let Ok(local_repo) = git2::Repository::discover(".") {
let mut name = remote.map(|s| s.to_owned());
// if there's only one remote, use that
@@ -557,7 +557,7 @@ pub async fn create_repo(
push: bool,
) -> eyre::Result<()> {
if remote.is_some() || push {
- let repo = git2::Repository::open(".")?;
+ let repo = git2::Repository::discover(".")?;
let upstream = remote.as_deref().unwrap_or("origin");
if repo.find_remote(upstream).is_ok() {
@@ -586,7 +586,7 @@ pub async fn create_repo(
println!("created new repo at {}", html_url);
if remote.is_some() || push {
- let repo = git2::Repository::open(".")?;
+ let repo = git2::Repository::discover(".")?;
let upstream = remote.as_deref().unwrap_or("origin");
let clone_url = new_repo