Open UrGuardian4ngel opened 1 week ago
💡 FYI, about that resolution:
I also tried playing by replacing this: https://github.com/gitext-rs/git-stack/blob/bd68887f0dc690166599eaa6d32fd0f353edfd86/src/legacy/git/repo.rs#L593
with something along these lines:
let id = match branch.get().kind().unwrap() {
git2::ReferenceType::Direct => branch.get().target().unwrap(),
git2::ReferenceType::Symbolic => {
let target_name = branch.get().symbolic_target().unwrap();
let target_branch = self
.repo
.find_branch(target_name, git2::BranchType::Local)
.or_else(|_| self.repo.find_branch(target_name, git2::BranchType::Remote))
.unwrap();
target_branch.get().target().unwrap()
},
};
Caution: As a non-Rust dev myself, this probably looks ugly to others... 🫣
Please complete the following tasks
Description
I'm using the
git symbolic-ref
command to create "fake" branch references. It looks likegit-stack
(and additionallygit-branch-stack
) doesn't play well with those yet.report-bb3a8cec-dc97-4362-956e-6def55fe6d1c.toml.zip
Background
Symbolic references allow me to quickly define some kind of short branch aliases for moving targets, e.g. version development branches. It boils down to something like this:
After which I can do things like this:
... without having to clutter my local branches with tons of
release-*
branches that always lag behind their upstream.When versions change, I just update the symbolic references. From now on, my "aliases" start pointing to the new versions.
No additional mental overhead required in fast-paced release cycles :ok_hand:!
Workaround
For now, I've made some local bandaid patch to silently ignore branches in
local_branches()
that are havingkind: ReferenceType::Symbolic
.Would be nice if we could handle these symbolic references in
load_local_branch()
, and resolve them to their target'sid
?Potential issues
:one: In my case, these symbolic refs mostly point to remote refs.
I guess this could also tie into discussion #93?
:two: These references could potentially be recursive:
sym-a -> sym-b -> some-branch
.Version
git-stack 0.10.17
Steps to reproduce
Actual Behaviour
git-stack
crashes in a repository that has one or more symbolic ref branches.Expected Behaviour
git-stack
should not crash in a repository that has one or more symbolic ref branches.Either by:
Debug Output