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: a7a079c2c4bc7b269229a6ea6c147b6b2d5b2684
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e4f9d6b0ab2e1903765258991a6265599d0007ce
Choose a head ref
  • 6 commits
  • 11 files changed
  • 2 contributors

Commits on Mar 6, 2026

  1. interpret-trailers: factor trailer rewriting

    Extract the trailer rewriting logic into a helper that appends to an
    output strbuf.
    
    Update interpret_trailers() to handle file I/O only: read input once,
    call the helper, and write the buffered result.
    
    This separation makes it easier to move the helper into trailer.c in the
    next commit.
    
    Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
    Signed-off-by: Li Chen <me@linux.beauty>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    FirstLoveLife authored and gitster committed Mar 6, 2026
    Configuration menu
    Copy the full SHA
    8efabc9 View commit details
    Browse the repository at this point in the history
  2. interpret-trailers: refactor create_in_place_tempfile()

    Refactor create_in_place_tempfile() in preparation for moving it
    to tralier.c. Change the return type to return a `struct tempfile*`
    instead of a `FILE*` so that we can remove the file scope tempfile
    variable. Since 076aa2c (tempfile: auto-allocate tempfiles on
    heap, 2017-09-05) it has not been necessary to make tempfile varibales
    static so this is safe. Also use error() and return NULL in place of
    die() so the caller can exit gracefully and use find_last_dir_sep()
    rather than strchr() to find the parent directory.
    
    Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    phillipwood authored and gitster committed Mar 6, 2026
    Configuration menu
    Copy the full SHA
    876b2eb View commit details
    Browse the repository at this point in the history
  3. trailer: libify a couple of functions

    Move create_in_place_tempfile() and process_trailers() from
    builtin/interpret-trailers.c into trailer.c and expose it via trailer.h.
    
    This reverts most of ae0ec2e (trailer: move interpret_trailers()
    to interpret-trailers.c, 2024-03-01) and lets other call sites reuse
    the same trailer rewriting logic.
    
    Signed-off-by: Li Chen <me@linux.beauty>
    Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    FirstLoveLife authored and gitster committed Mar 6, 2026
    Configuration menu
    Copy the full SHA
    a4fd4c5 View commit details
    Browse the repository at this point in the history
  4. trailer: append trailers without fork/exec

    Introduce amend_strbuf_with_trailers() to apply trailer additions to a
    message buffer via process_trailers(), avoiding the need to run git
    interpret-trailers as a child process.
    
    Update amend_file_with_trailers() to use the in-process helper and
    rewrite the target file via tempfile+rename, preserving the previous
    in-place semantics. As the trailers are no longer added in a separate
    process and trailer_config_init() die()s on missing config values it
    is called early on in cmd_commit() and cmd_tag() so that they die()
    early before writing the message file. The trailer arguments are now
    also sanity checked.
    
    Keep existing callers unchanged by continuing to accept argv-style
    --trailer=<trailer> entries and stripping the prefix before feeding the
    in-process implementation.
    
    Signed-off-by: Li Chen <me@linux.beauty>
    Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    FirstLoveLife authored and gitster committed Mar 6, 2026
    Configuration menu
    Copy the full SHA
    6b2243f View commit details
    Browse the repository at this point in the history
  5. commit, tag: parse --trailer with OPT_STRVEC

    Now that amend_file_with_trailers() expects raw trailer lines, do not
    store argv-style "--trailer=<trailer>" strings in git commit and git
    tag.
    
    Parse --trailer using OPT_STRVEC so trailer_args contains only the
    trailer value, and drop the temporary prefix stripping in
    amend_file_with_trailers().
    
    Signed-off-by: Li Chen <me@linux.beauty>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    FirstLoveLife authored and gitster committed Mar 6, 2026
    Configuration menu
    Copy the full SHA
    5e14869 View commit details
    Browse the repository at this point in the history
  6. rebase: support --trailer

    Add a new --trailer=<trailer> option to git rebase to append trailer
    lines to each rewritten commit message (merge backend only).
    
    Because the apply backend does not provide a commit-message filter,
    reject --trailer when --apply is in effect and require the merge backend
    instead.
    
    This option implies --force-rebase so that fast-forwarded commits are
    also rewritten. Validate trailer arguments early to avoid starting an
    interactive rebase with invalid input.
    
    Add integration tests covering error paths and trailer insertion across
    non-interactive and interactive rebases.
    
    Signed-off-by: Li Chen <me@linux.beauty>
    Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    FirstLoveLife authored and gitster committed Mar 6, 2026
    Configuration menu
    Copy the full SHA
    e4f9d6b View commit details
    Browse the repository at this point in the history
Loading