remote-helper: List `HEAD`
Report the default branch correctly via the symbolic reference `HEAD`.
This commit is contained in:
parent
101fbff809
commit
ef27961866
|
|
@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `rad clone` now supports the flag `--bare` which works analoguously to
|
- `rad clone` now supports the flag `--bare` which works analoguously to
|
||||||
`git clone --bare`.
|
`git clone --bare`.
|
||||||
- `rad init --setup-signing` now works on bare repositories.
|
- `rad init --setup-signing` now works on bare repositories.
|
||||||
|
- `git-remote-rad` now correctly reports the default branch to Git by listing
|
||||||
|
the symbolic reference `HEAD`.
|
||||||
|
|
||||||
## Fixed Bugs
|
## Fixed Bugs
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ pushing to their `rad` remote -- but they won't sync to the network just yet:
|
||||||
$ git commit -m "Alice's commit" --allow-empty -q
|
$ git commit -m "Alice's commit" --allow-empty -q
|
||||||
$ git push rad -o no-sync
|
$ git push rad -o no-sync
|
||||||
$ git ls-remote rad
|
$ git ls-remote rad
|
||||||
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 HEAD
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -43,6 +44,7 @@ $ git add README
|
||||||
$ git commit -m "Bob's commit" -q
|
$ git commit -m "Bob's commit" -q
|
||||||
$ git push rad -o no-sync
|
$ git push rad -o no-sync
|
||||||
$ git ls-remote rad
|
$ git ls-remote rad
|
||||||
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 HEAD
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -51,6 +53,7 @@ $ git add README
|
||||||
$ git commit -m "Eve's commit" -q
|
$ git commit -m "Eve's commit" -q
|
||||||
$ git push rad -o no-sync
|
$ git push rad -o no-sync
|
||||||
$ git ls-remote rad
|
$ git ls-remote rad
|
||||||
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 HEAD
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ List the canonical refs:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git ls-remote rad
|
$ git ls-remote rad
|
||||||
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 HEAD
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ $ git remote show rad
|
||||||
* remote rad
|
* remote rad
|
||||||
Fetch URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
Fetch URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
Push URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
Push URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||||
HEAD branch: (unknown)
|
HEAD branch: master
|
||||||
Remote branch:
|
Remote branch:
|
||||||
master new (next fetch will store in remotes/rad)
|
master new (next fetch will store in remotes/rad)
|
||||||
Local ref configured for 'git push':
|
Local ref configured for 'git push':
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ $ git remote show rad
|
||||||
* remote rad
|
* remote rad
|
||||||
Fetch URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
Fetch URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
Push URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
Push URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||||
HEAD branch: (unknown)
|
HEAD branch: master
|
||||||
Remote branch:
|
Remote branch:
|
||||||
master new (next fetch will store in remotes/rad)
|
master new (next fetch will store in remotes/rad)
|
||||||
Local ref configured for 'git push':
|
Local ref configured for 'git push':
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ $ git branch -r
|
||||||
$ git pull
|
$ git pull
|
||||||
Already up to date.
|
Already up to date.
|
||||||
$ git branch -r
|
$ git branch -r
|
||||||
|
rad/HEAD -> rad/master
|
||||||
rad/master
|
rad/master
|
||||||
rad/patches/5e2dedcc5d515fcbc1cca483d3376609fe889bfb
|
rad/patches/5e2dedcc5d515fcbc1cca483d3376609fe889bfb
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ $ rad patch show 55b9721
|
||||||
│ ↑ updated to f91e056da05b2d9a58af1160c76245bc3debf7a8 (cad2666) now │
|
│ ↑ updated to f91e056da05b2d9a58af1160c76245bc3debf7a8 (cad2666) now │
|
||||||
╰─────────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────────╯
|
||||||
$ git ls-remote rad
|
$ git ls-remote rad
|
||||||
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 HEAD
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||||
cad2666a8a2250e4dee175ed5044be2c251ff08b refs/heads/patches/55b9721ed7f6bfec38f43729e9b6631c5dc812fb
|
cad2666a8a2250e4dee175ed5044be2c251ff08b refs/heads/patches/55b9721ed7f6bfec38f43729e9b6631c5dc812fb
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ And let's look at our local and remote refs:
|
||||||
$ git show-ref
|
$ git show-ref
|
||||||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/feature/1
|
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/feature/1
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||||
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/HEAD
|
||||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/master
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/master
|
||||||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/6035d2f582afbe01ff23ea87528ae523d76875b6
|
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/6035d2f582afbe01ff23ea87528ae523d76875b6
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,15 @@ pub fn for_fetch<R: ReadRepository + cob::Store<Namespace = NodeId> + 'static>(
|
||||||
println!("{oid} {name}");
|
println!("{oid} {name}");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Listing canonical refs.
|
// List the symbolic reference `HEAD`, which is interpreted by
|
||||||
// We skip over `refs/rad/*`, since those are not meant to be fetched into a working copy.
|
// Git clients to determine the default branch.
|
||||||
|
match stored.head() {
|
||||||
|
Ok((target, _)) => println!("@{target} HEAD"),
|
||||||
|
Err(err) => eprintln!("remote: error resolving HEAD: {err}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// List canonical references.
|
||||||
|
// Skip over `refs/rad/*`, since those are not meant to be fetched into a working copy.
|
||||||
for glob in [
|
for glob in [
|
||||||
git::refspec::pattern!("refs/heads/*"),
|
git::refspec::pattern!("refs/heads/*"),
|
||||||
git::refspec::pattern!("refs/tags/*"),
|
git::refspec::pattern!("refs/tags/*"),
|
||||||
|
|
@ -56,8 +63,10 @@ pub fn for_fetch<R: ReadRepository + cob::Store<Namespace = NodeId> + 'static>(
|
||||||
println!("{oid} {name}");
|
println!("{oid} {name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// List the patch refs, but don't abort if there's an error, as this would break
|
|
||||||
// all fetch behavior. Instead, just output an error to the user.
|
// List the patch refs, but do not abort if there is an error,
|
||||||
|
// as this would break all fetch behavior.
|
||||||
|
// Instead, just output an error to the user.
|
||||||
if let Err(e) = patch_refs(profile, stored) {
|
if let Err(e) = patch_refs(profile, stored) {
|
||||||
eprintln!("remote: error listing patch refs: {e}");
|
eprintln!("remote: error listing patch refs: {e}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue