fix: address verified review findings (branches-checkout-status-1)

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-18 17:38:53 +02:00
1 parent 6e523d969d
commit 58f0fc4bf9
27 files changed
+281 -65

No files matched your search

+17 -1
View File
@@ -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)
}