Use `tmp` namespace for temporary refs during push

The `refs/tmp` namespace is used by Git for the purpose of storing
temporary refs. We use it here instead of `refs/patch` to indicate
that the refs can be safely deleted.
This commit is contained in:
Alexis Sellier 2023-05-13 23:16:32 +02:00
parent 7d68df86d1
commit 5ccd74aa8a
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -237,11 +237,11 @@ pub mod refs {
pub mod staging {
use super::*;
/// Where patches are pushed initially, when they don't have an object-id yet.
/// Where patch heads are pushed initially, before patch creation.
/// This is a short-lived reference, which is deleted after the patch has been opened.
/// The `<oid>` is the commit proposed in the patch.
///
/// `refs/namespaces/<remote>/refs/patch/heads/<oid>`
/// `refs/namespaces/<remote>/refs/tmp/heads/<oid>`
///
pub fn patch<'a>(remote: &RemoteId, oid: impl Into<Oid>) -> Namespaced<'a> {
// SAFETY: OIDs are valid reference names and valid path component.
@ -250,7 +250,7 @@ pub mod refs {
#[allow(clippy::unwrap_used)]
let oid = Component::from_refstr(oid).unwrap();
Qualified::from_components(component!("patch"), component!("heads"), Some(oid))
Qualified::from_components(component!("tmp"), component!("heads"), Some(oid))
.with_namespace(remote.into())
}
}