MCPcopy
hub / github.com/go-git/go-git / Worktree

Method Worktree

repository.go:1528–1545  ·  view source on GitHub ↗

Worktree returns a worktree based on the given fs, if nil the default worktree will be used.

()

Source from the content-addressed store, hash-verified

1526// Worktree returns a worktree based on the given fs, if nil the default
1527// worktree will be used.
1528func (r *Repository) Worktree() (*Worktree, error) {
1529 if r.wt == nil {
1530 return nil, ErrIsBareRepository
1531 }
1532
1533 protectNTFS := defaultProtectNTFS()
1534 protectHFS := defaultProtectHFS()
1535 if cfg, err := r.Config(); err == nil {
1536 if cfg.Core.ProtectNTFS.IsSet() {
1537 protectNTFS = cfg.Core.ProtectNTFS.IsTrue()
1538 }
1539 if cfg.Core.ProtectHFS.IsSet() {
1540 protectHFS = cfg.Core.ProtectHFS.IsTrue()
1541 }
1542 }
1543
1544 return &Worktree{r: r, Filesystem: newWorktreeFilesystem(r.wt, protectNTFS, protectHFS)}, nil
1545}
1546
1547func expand_ref(s storer.ReferenceStorer, ref plumbing.ReferenceName) (*plumbing.Reference, error) {
1548 // For improving troubleshooting, this preserves the error for the provided `ref`,

Callers 15

cloneMethod · 0.95
createCommitFunction · 0.80
TestCloneSparseMethod · 0.80
TestMergeFFMethod · 0.80
TestMergeFF_InvalidMethod · 0.80
TestPushDepthMethod · 0.80
TestWorktreeMethod · 0.80

Calls 6

ConfigMethod · 0.95
defaultProtectNTFSFunction · 0.85
defaultProtectHFSFunction · 0.85
newWorktreeFilesystemFunction · 0.85
IsTrueMethod · 0.80
IsSetMethod · 0.65

Tested by 15

createCommitFunction · 0.64
TestCloneSparseMethod · 0.64
TestMergeFFMethod · 0.64
TestMergeFF_InvalidMethod · 0.64
TestPushDepthMethod · 0.64
TestWorktreeMethod · 0.64
TestWorktreeBareMethod · 0.64