Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: aa95f87c740011f7d21555c5ad7f0870faf4b5c8
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1278a26544e81dddf564fd7730890a7e023ed367
Choose a head ref
  • 5 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 17, 2026

  1. builtin/history: perform revwalk checks before asking for user input

    When setting up the revision walk in git-history(1) we also perform some
    verifications whether the request actually looks sane. Unfortunately,
    these verifications come _after_ we have already asked the user for the
    commit message of the commit that is to be rewritten. So in case any of
    the verifications fails, the user will have lost their modifications.
    
    Extract the function to set up the revision walk and call it before we
    ask for user input to fix this.
    
    Adapt one of the tests that is expected to fail because of this check
    to use false(1) as editor. If the editor had been executed by Git, it
    would fail with the error message "Aborting commit as launching the
    editor failed."
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    76a3f28 View commit details
    Browse the repository at this point in the history
  2. builtin/history: check for merges before asking for user input

    The replay infrastructure is not yet capable of replaying merge commits.
    Unfortunately, we only notice that we're about to replay merges after we
    have already asked the user for input, so any commit message that the
    user may have written will be discarded in that case.
    
    Fix this by checking whether the revwalk contains merge commits before
    we ask for user input.
    
    Adapt one of the tests that is expected to fail because of this check
    to use false(1) as editor. If the editor had been executed by Git, it
    would fail with the error message "Aborting commit as launching the
    editor failed."
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    0f2a0c5 View commit details
    Browse the repository at this point in the history
  3. builtin/history: replace "--ref-action=print" with "--dry-run"

    The git-history(1) command has the ability to perform a dry-run
    that will not end up modifying any references. Instead, we'll only print
    any ref updates that would happen as a consequence of performing the
    operation.
    
    This mode is somewhat hidden though behind the "--ref-action=print"
    option. This command line option has its origin in git-replay(1), where
    it's probably an okayish interface as this command is sitting more on
    the plumbing side of tools. But git-history(1) is a user-facing tool,
    and this way of achieving a dry-run is way too technical and thus not
    very discoverable.
    
    Besides usability issues, it also has another issue: the dry-run mode
    will always operate as if the user wanted to rewrite all branches. But
    in fact, the user also has the option to only update the HEAD reference,
    and they might want to perform a dry-run of such an operation, too. We
    could of course introduce "--ref-action=print-head", but that would
    become even less ergonomic.
    
    Replace "--ref-action=print" with a new "--dry-run" toggle. This new
    toggle works with both "--ref-action={head,branches}" and is way more
    discoverable.
    
    Add a test to verify that both "--ref-action=" values behave as
    expected.
    
    This patch is best viewed with "--ignore-space-change".
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    1073fa1 View commit details
    Browse the repository at this point in the history
  4. builtin/history: rename "--ref-action=" to "--update-refs="

    With the preceding commit we have changed "--ref-action=" to only
    control which refs are supposed to be updated, not what happens with
    them. As a consequence, the option is now somewhat misnamed, as we don't
    control the action itself anymore.
    
    Rename it to "--update-refs=" to better align it with its new use.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    060e602 View commit details
    Browse the repository at this point in the history
  5. Documentation/git-history: document default for "--update-refs="

    While we document the values that can be passed to the "--update-refs="
    option, we don't give the user any hint what the default behaviour is.
    Document it.
    
    Signed-off-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pks-t authored and gitster committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    1278a26 View commit details
    Browse the repository at this point in the history
Loading