Skip to content

feat(but): use change ID in _commit2 output#14822

Closed
slarse wants to merge 1 commit into
masterfrom
use-change-id-in-commit2-output
Closed

feat(but): use change ID in _commit2 output#14822
slarse wants to merge 1 commit into
masterfrom
use-change-id-in-commit2-output

Conversation

@slarse

@slarse slarse commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

For the but2 commands, 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.

Copilot AI review requested due to automatic review settings July 16, 2026 16:56
@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _commit2 output from commit hash to change ID (human output uses a short 3-character display).
  • Extend JSON output to include a non-optional change_id field while keeping the full commit hash.
  • 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.

Comment thread crates/but/src/utils/change_id.rs Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 17:03
@slarse
slarse force-pushed the use-change-id-in-commit2-output branch from 00fbe60 to aba4529 Compare July 16, 2026 17:03
@slarse
slarse force-pushed the use-change-id-in-commit2-output branch from aba4529 to f8b0e88 Compare July 16, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 16, 2026 17:06
@slarse
slarse force-pushed the use-change-id-in-commit2-output branch from f8b0e88 to eed3627 Compare July 16, 2026 17:07
@slarse
slarse enabled auto-merge July 16, 2026 17:07
@slarse
slarse force-pushed the use-change-id-in-commit2-output branch from eed3627 to c349988 Compare July 16, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread crates/but/src/theme.rs
Copilot AI review requested due to automatic review settings July 16, 2026 17:08
@slarse
slarse force-pushed the use-change-id-in-commit2-output branch from c349988 to 0b04ff4 Compare July 16, 2026 17:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread crates/but/src/theme.rs
Comment thread crates/but/src/theme.rs
Copilot AI review requested due to automatic review settings July 16, 2026 17:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread crates/but/src/theme.rs
@slarse
slarse disabled auto-merge July 16, 2026 17:21
Copilot AI review requested due to automatic review settings July 16, 2026 17:27
@slarse
slarse force-pushed the use-change-id-in-commit2-output branch from 0b04ff4 to d029b4c Compare July 16, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread crates/but/src/theme.rs
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;
@slarse

slarse commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Closing, handling all but2 commands later.

@slarse slarse closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants