use gix::Id::shorten for legacy commit display IDs in but CLI#12633
Open
Byron wants to merge 3 commits intogitbutlerapp:masterfrom
Open
use gix::Id::shorten for legacy commit display IDs in but CLI#12633Byron wants to merge 3 commits intogitbutlerapp:masterfrom
but CLI#12633Byron wants to merge 3 commits intogitbutlerapp:masterfrom
Conversation
|
@chatgpt-codex-connector[bot] is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
Otherwise, each shorten will hit the disk to check for added objects, and we cannot have that.
116359e to
d65bc2c
Compare
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
d65bc2c to
c9bcd53
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the but CLI’s legacy command output to use gix’s repository-aware commit ID shortening (honoring core.abbrev and disambiguation), replacing fixed [..7] slicing and improving performance in high-volume display paths.
Changes:
- Add shared commit/object-id helpers (
shorten_object_id,shorten_hex_object_id,split_short_id) and wire them into legacy CLI output. - Introduce
RepositoryExt::for_commit_shortening()to avoid ODB refresh overhead when only shortening IDs for display. - Update relevant legacy commands and one snapshot test expectation to reflect the new abbreviated-ID formatting.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/but/tests/but/command/commit.rs | Updates oplog snapshot expectation to use the new short-hash placeholder. |
| crates/but/src/utils/object_id.rs | Adds shared helpers for repo-disambiguated object-id shortening and display splitting. |
| crates/but/src/utils/mod.rs | Re-exports the new object-id helper utilities. |
| crates/but/src/id/mod.rs | Exposes ShortId alias for use outside the id module. |
| crates/but/src/command/legacy/teardown.rs | Uses repo-aware shortening for snapshot/commit IDs in human output. |
| crates/but/src/command/legacy/status/mod.rs | Switches multiple commit-id displays to repo-aware shortening; updates assignment/commit rendering to avoid brittle slicing. |
| crates/but/src/command/legacy/show.rs | Uses repo-aware shortening for branch commit lists. |
| crates/but/src/command/legacy/rub/undo.rs | Uses repo-aware shortening when printing the uncommitted commit ID. |
| crates/but/src/command/legacy/rub/squash.rs | Uses repo-aware shortening in squash result output. |
| crates/but/src/command/legacy/rub/move_commit.rs | Uses repo-aware shortening in move-to-branch output. |
| crates/but/src/command/legacy/rub/move.rs | Uses repo-aware shortening in move-related human and JSON hint messages. |
| crates/but/src/command/legacy/rub/mod.rs | Uses repo-aware shortening in disambiguation prompts; adds repo config for fast shortening. |
| crates/but/src/command/legacy/rub/amend.rs | Uses repo-aware shortening + split styling for amended commit IDs. |
| crates/but/src/command/legacy/resolve.rs | Uses repo-aware shortening in conflict-resolution messages and errors. |
| crates/but/src/command/legacy/push.rs | Uses repo-aware shortening for push previews and SHA update output; configures repo for fast shortening where appropriate. |
| crates/but/src/command/legacy/pull/mod.rs | Uses repo-aware shortening for upstream commit displays; configures repo for fast shortening. |
| crates/but/src/command/legacy/pick.rs | Uses repo-aware shortening for user-facing picked-commit output and conflict messages; configures repo for fast shortening. |
| crates/but/src/command/legacy/oplog.rs | Uses repo-aware shortening/length selection for oplog commit IDs; configures repo for fast shortening. |
| crates/but/src/command/legacy/merge.rs | Uses repo-aware shortening in merge progress output. |
| crates/but/src/command/legacy/commit.rs | Uses repo-aware shortening in “insert blank commit” success message. |
| crates/but/src/command/legacy/branch/show.rs | Uses repo-aware shortening for commit lists shown in branch show output. |
| crates/but/src/command/legacy/branch/mod.rs | Uses repo-aware shortening when displaying anchor commit IDs. |
| crates/but/src/command/legacy/absorb.rs | Passes a repo configured for fast shortening into absorption plan display and shortens commit IDs via helper. |
| crates/but-core/src/repo_ext.rs | Adds for_commit_shortening() (sets ODB refresh mode to Never) and reorders impl blocks accordingly. |
Byron
commented
Mar 1, 2026
Comment on lines
+42
to
+45
| /// Return a repository configured for commit shortening, | ||
| /// i.e. with an object database configured to *not* check for new packs. | ||
| fn for_commit_shortening(self) -> Self; | ||
|
|
Collaborator
Author
There was a problem hiding this comment.
Only this method was added.
All the other changes are an automatic "align implementation order with declaration order" refactor offered by RA.
krlvi
approved these changes
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
Review Notes
but oplogchanged as I am using uniformly shortened commit-ids instead.Compare after and before.
To my mind, there is no need for the extra coloring, particularly now where the shortening takes care of disambiguating prefixes, while respecting
core.abbrev.