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:
Lunny Xiao
2020-04-01 03:22:24 +00:00
committed by John Olheiser
parent b37673c954
commit 7a10ea10df
12 changed files with 245 additions and 0 deletions

20
modules/git/ref.go Normal file
View 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()
}

View File

@ -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 (