Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Fix the test failures related to remote default branch (HEAD)
Merged levitte opened 10 days ago

The following two tests assumed that HEAD would always be there in the ‘rad’ remote. It turns out, however, that this isn’t necessarily the case, for example on Debian releases (as consistently noticed in multiple CI runs).

This change fixes this issue by explicitly setting the remote head, where this matters:

  • crates/radicle-cli/examples/rad-patch-fetch-2.md
  • crates/radicle-cli/examples/rad-patch-via-push.md
3 files changed +6 -2 354805ae 354805ae
modified crates/radicle-cli/examples/rad-patch-fetch-2.md
@@ -22,7 +22,6 @@ $ git branch -r
$ git pull
Already up to date.
$ git branch -r
-
  rad/HEAD -> rad/master
  rad/master
  rad/patches/5e2dedcc5d515fcbc1cca483d3376609fe889bfb
```
modified crates/radicle-cli/examples/rad-patch-via-push.md
@@ -62,7 +62,6 @@ And let's look at our local and remote refs:
$ git show-ref
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/feature/1
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
-
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/HEAD
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/master
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/6035d2f582afbe01ff23ea87528ae523d76875b6
```
modified crates/radicle/src/test/fixtures.rs
@@ -122,6 +122,12 @@ fn repository_with<P: AsRef<Path>>(
        let mut config = repo.config().unwrap();
        config.set_str("user.name", USER_NAME).unwrap();
        config.set_str("user.email", USER_EMAIL).unwrap();
+
        // Git older than v2.48.0 have the behaviour of 'remote.<remote>.followRemoteHEAD=never',
+
        // So we set it explicitly here for testing purposes, for consistent output of commands
+
        // like 'git branch -r' and 'git show-ref'
+
        config
+
            .set_str("remote.rad.followRemoteHEAD", "never")
+
            .unwrap();
    }

    let sig = git::raw::Signature::new(