Add helper functions to construct plain branch names (“main”), full branch refs (“refs/heads/main”), and namespaced full branch names (“refs/namespaces/$NID/refs/heads/main”).
Keeping track of while only using RefStrings is too hard to get right. We need to use the types provided by the radicle crate: BranchName, Qualified, and Namespaced. Even if I find the type names less than obvious, they’re much better than plain RefStrings.
Signed-off-by: Lars Wirzenius liw@liw.fi
fix: use new Git refs module, fix bugs found
This is a huge change, but it’s mostly a few kinds of similar changes in a lot of places. Unfortunately, they were not easy to tease apart into small, easily reviewed commits.
Use the Git ref types created by the new refs module. Fix problems this exposes.
The CiEvent enum variants for branch events now use the BranchName type for branch names. In other words, they have a plain branch name. The CiEvent::from_node_event constructor also always sets the branch name to a plain branch name, instead of a name spaced ref for updated or deleted branches. The ci_event.rs module’s unit tests have been fixed to use the correct kind of Git ref in each test. (It used to be a mess.)
The CI event filter “Branch” now contains a BranchName, previously a RefString. This should not break anything, as a RefString will always work as a BranchName.
The DefaultBranch filter now works, because it compares plain branch names, where it previously would compare a plain and a name spaced branch name, and those are never equal.
“cibtool trigger” and “cibtool event add” now add branch events with a plain branch instead of a name spaced ref.
Signed-off-by: Lars Wirzenius liw@liw.fi
Add helper functions to construct plain branch names (“main”), full branch refs (“refs/heads/main”), and namespaced full branch names (“refs/namespaces/$NID/refs/heads/main”).
Keeping track of while only using RefStrings is too hard to get right. We need to use the types provided by the radicle crate: BranchName, Qualified, and Namespaced. Even if I find the type names less than obvious, they’re much better than plain RefStrings.
Signed-off-by: Lars Wirzenius liw@liw.fi
fix: use new Git refs module, fix bugs found
This is a huge change, but it’s mostly a few kinds of similar changes in a lot of places. Unfortunately, they were not easy to tease apart into small, easily reviewed commits.
Use the Git ref types created by the new refs module. Fix problems this exposes.
The CiEvent enum variants for branch events now use the BranchName type for branch names. In other words, they have a plain branch name. The CiEvent::from_node_event constructor also always sets the branch name to a plain branch name, instead of a name spaced ref for updated or deleted branches. The ci_event.rs module’s unit tests have been fixed to use the correct kind of Git ref in each test. (It used to be a mess.)
The CI event filter “Branch” now contains a BranchName, previously a RefString. This should not break anything, as a RefString will always work as a BranchName.
The DefaultBranch filter now works, because it compares plain branch names, where it previously would compare a plain and a name spaced branch name, and those are never equal.
“cibtool trigger” and “cibtool event add” now add branch events with a plain branch instead of a name spaced ref.
Signed-off-by: Lars Wirzenius liw@liw.fi