Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
remote-helper: Do not assume remote name
✗ CI failure Lorenz Leutgeb committed 7 months ago
commit 211c22bdfa503ca1ec00c70fa1424ba6d079f833
parent 93c11fdbe9c02594527b5fb89105a72d9c53d5a1
1 failed (1 total) View logs
2 files changed +15 -16
modified crates/radicle-remote-helper/src/main.rs
@@ -187,9 +187,6 @@ pub fn run(profile: radicle::Profile) -> Result<(), Error> {
        }
    };

-
    // Assume the default remote if there was no remote.
-
    let remote = remote.unwrap_or_else(|| (*radicle::rad::REMOTE_NAME).clone());
-

    let stored = profile.storage.repository_mut(url.repo)?;
    if stored.is_empty()? {
        return Err(Error::RepositoryNotFound(stored.path().to_path_buf()));
modified crates/radicle-remote-helper/src/push.rs
@@ -246,7 +246,7 @@ impl PushAction {
/// Run a git push command.
pub fn run(
    mut specs: Vec<String>,
-
    remote: git::RefString,
+
    remote: Option<git::RefString>,
    url: Url,
    stored: &storage::git::Repository,
    profile: &Profile,
@@ -477,7 +477,7 @@ pub fn run(
/// Open a new patch.
fn patch_open<G>(
    src: &git::Oid,
-
    upstream: &git::RefString,
+
    upstream: &Option<git::RefString>,
    nid: &NodeId,
    working: &git::raw::Repository,
    stored: &storage::git::Repository,
@@ -564,17 +564,19 @@ where
                "Create reference for patch head",
            )?;

-
            // Setup current branch so that pushing updates the patch.
-
            if let Some(branch) = rad::setup_patch_upstream(&patch, head, working, upstream, false)?
-
            {
-
                if let Some(name) = branch.name()? {
-
                    if profile.hints() {
-
                        // Remove the remote portion of the name, i.e.
-
                        // rad/patches/deadbeef -> patches/deadbeef
-
                        let name = name.split('/').skip(1).collect::<Vec<_>>().join("/");
-
                        hint(format!(
-
                            "to update, run `git push` or `git push rad -f HEAD:{name}`"
-
                        ));
+
            if let Some(upstream) = upstream {
+
                // Setup current branch so that pushing updates the patch.
+
                if let Some(branch) = rad::setup_patch_upstream(&patch, head, working, upstream, false)?
+
                {
+
                    if let Some(name) = branch.name()? {
+
                        if profile.hints() {
+
                            // Remove the remote portion of the name, i.e.
+
                            // rad/patches/deadbeef -> patches/deadbeef
+
                            let name = name.split('/').skip(1).collect::<Vec<_>>().join("/");
+
                            hint(format!(
+
                                "to update, run `git push` or `git push rad -f HEAD:{name}`"
+
                            ));
+
                        }
                    }
                }
            }