upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/git.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/git.rs')
-rw-r--r--src/git.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/git.rs b/src/git.rs
index 13d56f3..faeb9f9 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -372,7 +372,7 @@ impl RepoActions for Repo {
372 if let Ok(last_patch) = patches_to_apply.last().context("no patches") { 372 if let Ok(last_patch) = patches_to_apply.last().context("no patches") {
373 last_patch 373 last_patch
374 } else { 374 } else {
375 self.checkout(branch_name).context("latest commit in pr doesnt connect with an existing commit. Try a git pull on master first.")?; 375 self.checkout(branch_name).context("latest commit in proposal doesnt connect with an existing commit. Try a git pull on master first.")?;
376 return Ok(vec![]); 376 return Ok(vec![]);
377 }, 377 },
378 "parent-commit", 378 "parent-commit",
@@ -387,9 +387,9 @@ impl RepoActions for Repo {
387 if let Ok(current_tip) = self.get_tip_of_local_branch(branch_name) { 387 if let Ok(current_tip) = self.get_tip_of_local_branch(branch_name) {
388 if !current_tip.to_string().eq(&parent_commit_id) { 388 if !current_tip.to_string().eq(&parent_commit_id) {
389 // TODO: either changes have been made on the local branch or 389 // TODO: either changes have been made on the local branch or
390 // the latest commit in the pr has rebased onto a newer commit 390 // the latest commit in the prpoosal has rebased onto a newer
391 // that you havn't pulled yet ask user whether 391 // commit that you havn't pulled yet ask user
392 // they want to proceed 392 // whether they want to proceed
393 } 393 }
394 } 394 }
395 395
@@ -1408,20 +1408,22 @@ mod tests {
1408 use test_utils::TEST_KEY_1_KEYS; 1408 use test_utils::TEST_KEY_1_KEYS;
1409 1409
1410 use super::*; 1410 use super::*;
1411 use crate::{repo_ref::RepoRef, sub_commands::send::generate_pr_and_patch_events}; 1411 use crate::{
1412 repo_ref::RepoRef, sub_commands::send::generate_cover_letter_and_patch_events,
1413 };
1412 1414
1413 static BRANCH_NAME: &str = "add-example-feature"; 1415 static BRANCH_NAME: &str = "add-example-feature";
1414 // returns original_repo, pr_event, patch_events 1416 // returns original_repo, cover_letter_event, patch_events
1415 fn generate_test_repo_and_events() -> Result<(GitTestRepo, nostr::Event, Vec<nostr::Event>)> 1417 fn generate_test_repo_and_events() -> Result<(GitTestRepo, nostr::Event, Vec<nostr::Event>)>
1416 { 1418 {
1417 let original_repo = GitTestRepo::default(); 1419 let original_repo = GitTestRepo::default();
1418 let oid3 = original_repo.populate_with_test_branch()?; 1420 let oid3 = original_repo.populate_with_test_branch()?;
1419 let oid2 = original_repo.git_repo.find_commit(oid3)?.parent_id(0)?; 1421 let oid2 = original_repo.git_repo.find_commit(oid3)?.parent_id(0)?;
1420 let oid1 = original_repo.git_repo.find_commit(oid2)?.parent_id(0)?; 1422 let oid1 = original_repo.git_repo.find_commit(oid2)?.parent_id(0)?;
1421 // TODO: generate pr and patch events 1423 // TODO: generate cover_letter and patch events
1422 let git_repo = Repo::from_path(&original_repo.dir)?; 1424 let git_repo = Repo::from_path(&original_repo.dir)?;
1423 1425
1424 let mut events = generate_pr_and_patch_events( 1426 let mut events = generate_cover_letter_and_patch_events(
1425 Some(("test".to_string(), "test".to_string())), 1427 Some(("test".to_string(), "test".to_string())),
1426 &git_repo, 1428 &git_repo,
1427 &vec![oid_to_sha1(&oid1), oid_to_sha1(&oid2), oid_to_sha1(&oid3)], 1429 &vec![oid_to_sha1(&oid1), oid_to_sha1(&oid2), oid_to_sha1(&oid3)],
@@ -1441,7 +1443,7 @@ mod tests {
1441 use super::*; 1443 use super::*;
1442 1444
1443 #[test] 1445 #[test]
1444 fn branch_gets_created_with_name_specified_in_pr() -> Result<()> { 1446 fn branch_gets_created_with_name_specified_in_proposal() -> Result<()> {
1445 let (_, _, patch_events) = generate_test_repo_and_events()?; 1447 let (_, _, patch_events) = generate_test_repo_and_events()?;
1446 let test_repo = GitTestRepo::default(); 1448 let test_repo = GitTestRepo::default();
1447 test_repo.populate()?; 1449 test_repo.populate()?;
@@ -1530,7 +1532,7 @@ mod tests {
1530 use super::*; 1532 use super::*;
1531 1533
1532 #[test] 1534 #[test]
1533 fn branch_gets_created_with_name_specified_in_pr() -> Result<()> { 1535 fn branch_gets_created_with_name_specified_in_proposal() -> Result<()> {
1534 let (_, _, patch_events) = generate_test_repo_and_events()?; 1536 let (_, _, patch_events) = generate_test_repo_and_events()?;
1535 let test_repo = GitTestRepo::default(); 1537 let test_repo = GitTestRepo::default();
1536 test_repo.populate()?; 1538 test_repo.populate()?;
@@ -1609,7 +1611,7 @@ mod tests {
1609 } 1611 }
1610 } 1612 }
1611 1613
1612 // TODO when_pr_root_is_tip_ahead_of_main_and_doesnt_exist 1614 // TODO when_proposal_root_is_tip_ahead_of_main_and_doesnt_exist
1613 } 1615 }
1614 1616
1615 mod when_branch_and_first_commits_exists { 1617 mod when_branch_and_first_commits_exists {