Release/1.0 #1

Merged
k3nny merged 19 commits from release/1.0 into main 2026-07-11 22:11:21 +02:00
3 changed files with 15 additions and 7 deletions
Showing only changes of commit a4cd00cc4d - Show all commits
+6
View File
@@ -852,6 +852,9 @@ func TestPrintVerboseConfigDirect(t *testing.T) {
// ── initConfig coverage ─────────────────────────────────────────────────────── // ── initConfig coverage ───────────────────────────────────────────────────────
func TestInitConfigWriteFails(t *testing.T) { func TestInitConfigWriteFails(t *testing.T) {
if os.Getuid() == 0 {
t.Skip("skipping: chmod restrictions do not apply when running as root")
}
dir := t.TempDir() dir := t.TempDir()
os.Chmod(dir, 0555) os.Chmod(dir, 0555)
defer os.Chmod(dir, 0755) defer os.Chmod(dir, 0755)
@@ -904,6 +907,9 @@ func TestRunWorkingTreeCheckFails(t *testing.T) {
} }
func TestRunLatestTagFails(t *testing.T) { func TestRunLatestTagFails(t *testing.T) {
if os.Getuid() == 0 {
t.Skip("skipping: chmod restrictions do not apply when running as root")
}
_, dir := setupRepo(t) _, dir := setupRepo(t)
addFile(t, dir, "x.go", "// fix") addFile(t, dir, "x.go", "// fix")
repo, _ := gogit.PlainOpen(dir) repo, _ := gogit.PlainOpen(dir)
+6 -7
View File
@@ -752,20 +752,19 @@ func TestLatestTagTagsIterFails(t *testing.T) {
repo, dir := newTestRepo(t) repo, dir := newTestRepo(t)
addCommit(t, repo, dir, "fix: c1", "v1") addCommit(t, repo, dir, "fix: c1", "v1")
if os.Getuid() == 0 {
t.Skip("skipping: chmod restrictions do not apply when running as root")
}
// Make .git/refs/tags/ unreadable so that go-git's walkReferencesTree // Make .git/refs/tags/ unreadable so that go-git's walkReferencesTree
// returns EPERM when it tries to list the directory, triggering the // returns EPERM when it tries to list the directory, triggering the
// Tags() error path. Skip when running as root (chmod has no effect). // Tags() error path.
tagsDir := filepath.Join(dir, ".git", "refs", "tags") tagsDir := filepath.Join(dir, ".git", "refs", "tags")
if err := os.Chmod(tagsDir, 0000); err != nil { os.Chmod(tagsDir, 0000)
t.Skipf("cannot chmod %s: %v", tagsDir, err)
}
t.Cleanup(func() { os.Chmod(tagsDir, 0755) }) t.Cleanup(func() { os.Chmod(tagsDir, 0755) })
// Reopen so the filesystem storer holds no cached state. // Reopen so the filesystem storer holds no cached state.
repo2, err := gogit.PlainOpen(dir) repo2, err := gogit.PlainOpen(dir)
if err != nil {
t.Skipf("PlainOpen failed (likely running as root): %v", err)
}
_, _, err = LatestTag(repo2, branch.Info{Major: 1, Minor: 2, TagPrefix: "v"}) _, _, err = LatestTag(repo2, branch.Info{Major: 1, Minor: 2, TagPrefix: "v"})
if err == nil { if err == nil {
+3
View File
@@ -124,6 +124,9 @@ func TestWriteVersionNotFound(t *testing.T) {
} }
func TestWriteVersionReadOnly(t *testing.T) { func TestWriteVersionReadOnly(t *testing.T) {
if os.Getuid() == 0 {
t.Skip("skipping: chmod restrictions do not apply when running as root")
}
path := writeGradle(t, gradleKotlin) path := writeGradle(t, gradleKotlin)
os.Chmod(path, 0444) os.Chmod(path, 0444)
defer os.Chmod(path, 0644) defer os.Chmod(path, 0644)