mirror of
https://gitea.com/Sirherobrine23/tea.git
synced 2024-07-07 10:26:21 -03:00
Fix open default to home page Improve path join and open with no arg add labels and milestones Add tea open Reviewed-on: https://gitea.com/gitea/tea/pulls/101 Reviewed-by: 6543 <6543@noreply.gitea.io> Reviewed-by: John Olheiser <john.olheiser@gmail.com>
21 lines
556 B
Go
21 lines
556 B
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package git
|
|
|
|
import (
|
|
go_git "gopkg.in/src-d/go-git.v4"
|
|
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
)
|
|
|
|
// GetRepoReference returns the current repository's current branch or tag
|
|
func GetRepoReference(p string) (*plumbing.Reference, error) {
|
|
gitPath, err := go_git.PlainOpenWithOptions(p, &go_git.PlainOpenOptions{DetectDotGit: true})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return gitPath.Head()
|
|
}
|