remote-helper: Add hint about updating patch
This commit is contained in:
parent
8e76ce03d5
commit
7d67dd6cb6
|
|
@ -3,12 +3,16 @@
|
|||
Let's checkout a branch, make a commit and push to the magic ref `refs/patches`.
|
||||
When we push to this ref, a patch is created from our commits.
|
||||
|
||||
``` (stderr)
|
||||
``` (stderr) RAD_HINT=1
|
||||
$ git checkout -b feature/1
|
||||
Switched to a new branch 'feature/1'
|
||||
$ git commit -a -m "Add things" -q --allow-empty
|
||||
$ git push -o patch.message="Add things #1" -o patch.message="See commits for details." rad HEAD:refs/patches
|
||||
✓ Patch 82faae29b2a2f11bf45bbba4c4787d6b32a12447 opened
|
||||
hint: to update, run `git push`,
|
||||
or `git push rad -f HEAD:rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447`
|
||||
hint: offline push, your node is not running
|
||||
to sync with the network, run `rad node start`
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
* [new reference] HEAD -> refs/patches
|
||||
```
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ pub fn run(
|
|||
let working = git::raw::Repository::open(working)?;
|
||||
|
||||
if dst == &*rad::PATCHES_REFNAME {
|
||||
patch_open(src, &nid, &working, stored, &signer, opts.clone())
|
||||
patch_open(src, &nid, &working, stored, &signer, profile, opts.clone())
|
||||
} else {
|
||||
let dst = git::Qualified::from_refstr(dst)
|
||||
.ok_or_else(|| Error::InvalidQualifiedRef(dst.clone()))?;
|
||||
|
|
@ -288,7 +288,7 @@ pub fn run(
|
|||
sync(stored.id, node).ok();
|
||||
} else if hints {
|
||||
eprintln!("hint: offline push, your node is not running");
|
||||
eprintln!("hint: to sync with the network, run `rad node start`");
|
||||
eprintln!(" to sync with the network, run `rad node start`");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -306,6 +306,7 @@ fn patch_open<G: Signer>(
|
|||
working: &git::raw::Repository,
|
||||
stored: &storage::git::Repository,
|
||||
signer: &G,
|
||||
profile: &Profile,
|
||||
opts: Options,
|
||||
) -> Result<(), Error> {
|
||||
let reference = working.find_reference(src.as_str())?;
|
||||
|
|
@ -384,7 +385,16 @@ fn patch_open<G: Signer>(
|
|||
)?;
|
||||
|
||||
// Setup current branch so that pushing updates the patch.
|
||||
rad::setup_patch_upstream(&patch, commit.id().into(), working, false)?;
|
||||
if let Some(branch) =
|
||||
rad::setup_patch_upstream(&patch, commit.id().into(), working, false)?
|
||||
{
|
||||
if let Some(name) = branch.name()? {
|
||||
if profile.hints() {
|
||||
eprintln!("hint: to update, run `git push`,");
|
||||
eprintln!(" or `git push rad -f HEAD:{name}`");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue