Skip to content

Commit

Permalink
add getBranchesByHash method (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 15, 2023
1 parent 4a27613 commit dfdb3e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/store/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ func (r *Refs) getBranchPos(branchName string) int {
return NewBranchFlag
}

func (r *Refs) getBranchesByHash(hash sha.SHA1) []*branch {
var branches []*branch
for _, branch := range r.Heads {
if branch.hash.String() == hash.String() {
branches = append(branches, branch)
}
}

return branches
}

func (r *Refs) DeleteBranch(rootGoitPath, headBranchName, deleteBranchName string) error {
// branch validation
if deleteBranchName == headBranchName {
Expand Down

0 comments on commit dfdb3e8

Please sign in to comment.