feat(but): use change ID in _commit2 output#14822
Closed
slarse wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the legacy _commit2 CLI output to use the commit’s stable change ID (rather than the commit hash) across human/shell formats, and includes the change ID in JSON output to match the planned “change IDs always persisted” behavior for but2 commands.
Changes:
- Switch human and shell
_commit2output from commit hash to change ID (human output uses a short 3-character display). - Extend JSON output to include a non-optional
change_idfield while keeping the fullcommithash. - Add a small utility (
shorten_change_id) with unit tests, and adjust existing CLI tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/but/tests/but/command/commit2.rs | Updates snapshots and adds a test to confirm human output shortens change IDs. |
| crates/but/src/utils/mod.rs | Exposes the new change-id utility from utils. |
| crates/but/src/utils/change_id.rs | Adds shorten_change_id() plus unit tests. |
| crates/but/src/command/legacy/status/tui/app/commit_mode.rs | Updates destructuring to account for the new change_id field in CommitOutcome. |
| crates/but/src/command/legacy/commit2.rs | Implements change-id based output and includes change_id in JSON output. |
slarse
force-pushed
the
use-change-id-in-commit2-output
branch
from
July 16, 2026 17:03
00fbe60 to
aba4529
Compare
slarse
force-pushed
the
use-change-id-in-commit2-output
branch
from
July 16, 2026 17:05
aba4529 to
f8b0e88
Compare
slarse
force-pushed
the
use-change-id-in-commit2-output
branch
from
July 16, 2026 17:07
f8b0e88 to
eed3627
Compare
slarse
enabled auto-merge
July 16, 2026 17:07
slarse
force-pushed
the
use-change-id-in-commit2-output
branch
from
July 16, 2026 17:08
eed3627 to
c349988
Compare
slarse
force-pushed
the
use-change-id-in-commit2-output
branch
from
July 16, 2026 17:10
c349988 to
0b04ff4
Compare
slarse
disabled auto-merge
July 16, 2026 17:21
slarse
force-pushed
the
use-change-id-in-commit2-output
branch
from
July 16, 2026 17:27
0b04ff4 to
d029b4c
Compare
Comment on lines
+619
to
+620
| /// Minimum number of change ID characters shown in human-readable output. | ||
| pub(crate) const MIN_DISPLAYED_CHANGE_ID_CHARS: usize = 3; |
Contributor
Author
|
Closing, handling all |
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.
For the
but2commands, we're pretending like change IDs are always persisted, which we plan for them to be shortly. Hence, change ID is not optional in this output.