mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 01:48:30 +02:00
Add tea open (#101)
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>
This commit is contained in:

committed by
John Olheiser

parent
b37673c954
commit
7a10ea10df
20
modules/git/ref.go
Normal file
20
modules/git/ref.go
Normal file
@ -0,0 +1,20 @@
|
||||
// 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()
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
// Copyright 2019 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 (
|
||||
|
Reference in New Issue
Block a user