rm old code
This commit is contained in:
parent
2204624369
commit
587a3debeb
68
branches.go
68
branches.go
|
@ -19,74 +19,6 @@ func (repo *Repo) ExistsUserBranchRemote() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// returns true if the user branch exists
|
|
||||||
func (repo *Repo) ExistsUserBranch() bool {
|
|
||||||
if repo.GetUserBranchName() == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
branchname := repo.GetUserBranchName()
|
|
||||||
if repo.Exists(filepath.Join(".git/refs/heads", branchname)) {
|
|
||||||
// todo: actually use .git/config
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return repo.IsBranchRemote(branchname)
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns true if the devel branch exists
|
|
||||||
func (repo *Repo) ExistsDevelBranch() bool {
|
|
||||||
if repo.GetDevelBranchName() == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
branchname := repo.GetDevelBranchName()
|
|
||||||
if repo.Exists(filepath.Join(".git/refs/heads", branchname)) {
|
|
||||||
// todo: actually use .git/config
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return repo.IsBranchRemote(branchname)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (repo *Repo) GetBranchHash(branchname string) string {
|
|
||||||
if branchname == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if repo.Exists(filepath.Join(".git/refs/remotes", branchname)) {
|
|
||||||
return readRefHash(filepath.Join(repo.FullPath, ".git/refs/remotes", branchname))
|
|
||||||
}
|
|
||||||
if repo.Exists(filepath.Join(".git/refs/heads", branchname)) {
|
|
||||||
return readRefHash(filepath.Join(repo.FullPath, ".git/refs/heads", branchname))
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
func (repo *Repo) GetBranchVersion(branchname string) string {
|
|
||||||
if branchname == repo.GetUserBranchName() {
|
|
||||||
return "user"
|
|
||||||
}
|
|
||||||
if branchname == repo.GetDevelBranchName() {
|
|
||||||
return "devel"
|
|
||||||
}
|
|
||||||
if branchname == repo.GetMasterBranchName() {
|
|
||||||
return "master"
|
|
||||||
}
|
|
||||||
base, branchname := filepath.Split(branchname)
|
|
||||||
if base != "" {
|
|
||||||
if branchname == repo.GetUserBranchName() {
|
|
||||||
return "remote user"
|
|
||||||
}
|
|
||||||
if branchname == repo.GetDevelBranchName() {
|
|
||||||
return "remote devel"
|
|
||||||
}
|
|
||||||
if branchname == repo.GetMasterBranchName() {
|
|
||||||
return "remote master"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func readRefHash(filename string) string {
|
func readRefHash(filename string) string {
|
||||||
data, _ := os.ReadFile(filename)
|
data, _ := os.ReadFile(filename)
|
||||||
return string(data)
|
return string(data)
|
||||||
|
|
Loading…
Reference in New Issue