Skip to content

feat: add configurable branch_prefix and commit_prefix settings#567

Open
moisei wants to merge 1 commit intoentireio:mainfrom
moisei:feat/custom-branch-commit-prefix
Open

feat: add configurable branch_prefix and commit_prefix settings#567
moisei wants to merge 1 commit intoentireio:mainfrom
moisei:feat/custom-branch-commit-prefix

Conversation

@moisei
Copy link

@moisei moisei commented Mar 1, 2026

Intro

Many organizations enforce strict policies on git branch naming conventions and commit message formats. With the current hardcoded entire/ prefix and Checkpoint commit subject, Entire's branches and commits fail these checks out of the box - effectively blocking adoption in those environments. This PR addresses the issue by allowing users to configure custom branch name prefixes and commit message prefixes.

Summary

  • Adds two new settings to .entire/settings.json for customizing branch names and commit message prefixes
  • branch_prefix (default "entire/") — controls shadow branch prefix and metadata branch name (e.g. "jfrog/"jfrog/checkpoints/v1)
  • commit_prefix (default "Checkpoint") — controls checkpoint commit subject prefix (e.g. "JFrog Checkpoint"JFrog Checkpoint: a3b2c4d5e6f7)
  • Enables running Entire on internal GitHub Enterprise without colliding with public conventions

Changes

  • settings.go: new branch_prefix / commit_prefix fields with getters, validation, and merge logic
  • paths.go: MetadataBranchName changed from const to configurable var with ConfigureBranchPrefix()
  • temporary.go: ShadowBranchPrefix changed from const to configurable var with ConfigureBranchPrefix()/ConfigureCommitPrefix()
  • committed.go: commit subject uses configurable prefix instead of hardcoded "Checkpoint"
  • cleanup.go: IsShadowBranch() uses configurable prefix instead of hardcoded regex
  • root.go, hooks_git_cmd.go, hook_registry.go: configure prefixes from settings during CLI/hook startup
  • settings_test.go: comprehensive tests for new fields (getters, loading, validation, merge)

Test plan

  • All existing unit tests pass (go test ./cmd/entire/cli/...)
  • All integration tests pass (go test -tags integration ./cmd/entire/cli/...)
  • New settings tests cover: default values, explicit values, metadata branch derivation, loading from file, validation (missing /, .., invalid chars), local override merge
  • Manual test with custom settings to verify branch names and commit subjects use configured prefixes

🤖 Generated with Claude Code

Add two new settings to .entire/settings.json for customizing branch
names and commit message prefixes. This enables using Entire on internal
GitHub Enterprise deployments without colliding with public conventions.

New settings:
- branch_prefix: customizes shadow branch prefix and metadata branch
  name (default: "entire/", e.g. "jfrog/" → "jfrog/checkpoints/v1")
- commit_prefix: customizes checkpoint commit subject prefix
  (default: "Checkpoint", e.g. "JFrog Checkpoint")

Settings are applied via ConfigureBranchPrefix/ConfigureCommitPrefix
called during CLI startup (PersistentPreRun) and hook initialization.
All existing behavior is preserved when settings are not specified.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@moisei moisei requested a review from a team as a code owner March 1, 2026 16:52
@Soph
Copy link
Collaborator

Soph commented Mar 1, 2026

Thanks for making the PR, could you help us understand more what's the use case is or what problem you are trying to solve? The issue with this approach is, that everything using the commits would need to know what the right prefix is to be used for lookup. Especially on entire.io this would be an issue and adds complexity.

@moisei
Copy link
Author

moisei commented Mar 1, 2026

Hi @Soph , I've added this Intro to PR. Please lemme know if it is more clear now

Many organizations enforce strict policies on git branch naming conventions and commit message formats. With the current hardcoded entire/ prefix and Checkpoint commit subject, Entire's branches and commits fail these checks out of the box - effectively blocking adoption in those environments. This PR addresses the issue by allowing users to configure custom branch name prefixes and commit message prefixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants