From 9cd3e43b899b23b7f6e75276fa3d19bf9550f8fd Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 9 Feb 2024 07:21:00 +0000 Subject: refactor(git): find root commit from head this is simpler there is no need to check whether main or master exist because one does 99+% of the time the root commit wil be te same for head as master 99+% of the time --- src/sub_commands/prs/create.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/sub_commands/prs/create.rs') diff --git a/src/sub_commands/prs/create.rs b/src/sub_commands/prs/create.rs index 82824a1..8506303 100644 --- a/src/sub_commands/prs/create.rs +++ b/src/sub_commands/prs/create.rs @@ -103,7 +103,7 @@ pub async fn launch( let repo_ref = repo_ref::fetch( &git_repo, git_repo - .get_root_commit(&to_branch) + .get_root_commit() .context("failed to get root commit of the repository")? .to_string(), &client, @@ -111,15 +111,8 @@ pub async fn launch( ) .await?; - let events = generate_pr_and_patch_events( - &title, - &description, - &to_branch, - &git_repo, - &ahead, - &keys, - &repo_ref, - )?; + let events = + generate_pr_and_patch_events(&title, &description, &git_repo, &ahead, &keys, &repo_ref)?; println!( "posting 1 pull request with {} commits...", @@ -315,14 +308,13 @@ pub static PATCH_KIND: u64 = 1617; pub fn generate_pr_and_patch_events( title: &str, description: &str, - to_branch: &str, git_repo: &Repo, commits: &Vec, keys: &nostr::Keys, repo_ref: &RepoRef, ) -> Result> { let root_commit = git_repo - .get_root_commit(to_branch) + .get_root_commit() .context("failed to get root commit of the repository")?; let mut pr_tags = vec![ -- cgit v1.2.3