mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix: address verified review findings (branches-checkout-status-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
27 files changed
+281
-65
No files matched your search
@@ -5,13 +5,14 @@ package git
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCurrentBranchConfig(t *testing.T) {
|
||||
const head = "symbolic-ref --short HEAD"
|
||||
const head = "symbolic-ref --quiet HEAD"
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
runner discoverRunner
|
||||
@@ -39,3 +40,18 @@ func TestCurrentBranchConfig(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCurrentBranchIgnoresATagWithTheSameName(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for _, args := range [][]string{
|
||||
{"init", "--quiet", "--initial-branch=rel-2"},
|
||||
{"-c", "user.name=t", "-c", "user.email=t@example.test", "commit", "--quiet", "--allow-empty", "--message=x"},
|
||||
{"tag", "rel-2"},
|
||||
} {
|
||||
out, err := exec.Command("git", append([]string{"-C", dir}, args...)...).CombinedOutput()
|
||||
require.NoError(t, err, string(out))
|
||||
}
|
||||
name, err := CurrentBranch(context.Background(), System{}, dir)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "rel-2", name)
|
||||
}
|
||||
Reference in new issue
Block a user