• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

numtide / treefmt / 24084780920

07 Apr 2026 01:46PM UTC coverage: 39.742% (+0.3%) from 39.492%
24084780920

push

github

web-flow
Merge pull request #678 from numtide/updates

Some fixes and updates

56 of 64 new or added lines in 10 files covered. (87.5%)

802 of 2018 relevant lines covered (39.74%)

17.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/git/git.go
1
package git
2

3
import (
4
        "context"
5
        "errors"
6
        "fmt"
7
        "os/exec"
8
        "strings"
9
)
10

11
const TreeRootCmd = "git rev-parse --show-toplevel"
12

13
func IsInsideWorktree(path string) (bool, error) {
×
14
        // check if the root is a git repository
×
NEW
15
        cmd := exec.CommandContext(context.Background(), "git", "rev-parse", "--is-inside-work-tree")
×
16
        cmd.Dir = path
×
17

×
18
        out, err := cmd.Output()
×
19
        if err != nil {
×
20
                var exitErr *exec.ExitError
×
21
                if errors.As(err, &exitErr) && strings.Contains(string(exitErr.Stderr), "not a git repository") {
×
22
                        return false, nil
×
23
                }
×
24

25
                return false, fmt.Errorf("failed to check if %s is a git repository: %w", path, err)
×
26
        }
27

28
        if strings.Trim(string(out), "\n") != "true" {
×
29
                // not a git repo
×
30
                return false, nil
×
31
        }
×
32

33
        // is a git repo
34
        return true, nil
×
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc