gittuf/pkg/gitinterface
lakshit verma a7e72c4c05
gitinterface: resolve worktrees for detached git dirs and worktrees
Worktree resolution chopped ".git" off the resolved GIT_DIR path, which
only works for the standard <repo>/.git layout. This breaks repositories
created with --separate-git-dir, misclassifies linked worktrees as bare
(so file restoration was silently skipped), and misclassifies bare
repositories named foo.git as non-bare. Linked worktrees could not even
be loaded because ensureNoCompatObjectFormat expects a config file that
only exists in the repository's common Git directory.

- add Repository.GetWorktree() resolving via $GIT_DIR/gitdir,
  core.worktree, load-time discovery, then the standard layout;
  validated so stale or malformed records fall through cleanly
- determine bareness via rev-parse --is-bare-repository instead of the
  GIT_DIR name, exposed through the ErrNoWorktree sentinel
- read configuration from the common directory via $GIT_DIR/commondir
- route Status(), RestoreWorktree(), and post-propagation restore
  through GetWorktree()

Fixes #1006

Signed-off-by: lakshit verma <vermalucky2004@gmail.com>
2026-08-24 16:16:00 +05:30
..
blob.go
blob_test.go test: improve pkg/gitinterface coverage from 69.4% to 76.2% 2026-04-25 02:44:19 +05:30
changes.go
changes_test.go pkg/gitinterface: Add and refactor tests for coverage 2026-04-30 02:47:33 +05:30
commit.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
commit_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
common.go feat(sha256): support SHA-256 object format 2026-07-16 23:03:18 +01:00
common_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
config.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
config_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
hash.go refactor: standardize on githash.Hash 2026-08-03 21:27:52 +01:00
hash_test.go
log.go
log_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
object.go
object_test.go test: improve pkg/gitinterface coverage from 69.4% to 76.2% 2026-04-25 02:44:19 +05:30
README.md
references.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
references_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
remote.go
remote_test.go
replace_ref_test.go gitinterface: ignore refs/replace/ in git invocations 2026-07-24 09:51:15 +01:00
repository.go gitinterface: resolve worktrees for detached git dirs and worktrees 2026-08-24 16:16:00 +05:30
repository_test.go gitinterface: resolve worktrees for detached git dirs and worktrees 2026-08-24 16:16:00 +05:30
signature.go deps: Bump gitsign 2026-08-17 15:16:10 -07:00
signature_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
status.go gitinterface: resolve worktrees for detached git dirs and worktrees 2026-08-24 16:16:00 +05:30
status_test.go Merge pull request #1273 from ayuxsh009/fix/status-rename-parser 2026-04-29 20:24:55 +00:00
sync.go Block use of extensions.compatObjectFormat 2026-07-16 23:03:24 +01:00
sync_test.go feat(sha256): support SHA-256 object format 2026-07-16 23:03:18 +01:00
tag.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
tag_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
tree.go gitinterface: resolve worktrees for detached git dirs and worktrees 2026-08-24 16:16:00 +05:30
tree_test.go Introduce gitstore.Storer and make gittuf's core dependency-light 2026-08-03 21:27:49 +01:00
utils.go gitinterface: resolve worktrees for detached git dirs and worktrees 2026-08-24 16:16:00 +05:30
utils_test.go test: improve pkg/gitinterface coverage from 69.4% to 76.2% 2026-04-25 02:44:19 +05:30
worktree_test.go gitinterface: resolve worktrees for detached git dirs and worktrees 2026-08-24 16:16:00 +05:30

gittuf's gitinterface Package

gittuf's gitinterface package is a lightweight Go API for interacting with Git repositories. It is similar to go-git in its goal, but differs as, unlike go-git, gitinterface uses the Git binary for its operations.

To operate correctly, gitinterface requires a Git binary version of 2.34 or higher.