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: 9a8aebae972de22ecd5adb92fec9d77147949c8a
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ec1c4d974ac74afb4f0574d29f7bbb30c1c46431
Choose a head ref
  • 10 commits
  • 17 files changed
  • 3 contributors

Commits on Feb 4, 2026

  1. Merge branch 'ar/run-command-hook-take-2' into ar/config-hooks

    * ar/run-command-hook-take-2:
      receive-pack: convert receive hooks to hook API
      receive-pack: convert update hooks to new API
      run-command: poll child input in addition to output
      hook: add jobs option
      reference-transaction: use hook API instead of run-command
      transport: convert pre-push to hook API
      hook: allow separate std[out|err] streams
      hook: convert 'post-rewrite' hook in sequencer.c to hook API
      hook: provide stdin via callback
      run-command: add stdin callback for parallelization
      run-command: add helper for pp child states
      t1800: add hook output stream tests
    gitster committed Feb 4, 2026
    Configuration menu
    Copy the full SHA
    468b5f7 View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2026

  1. hook: add internal state alloc/free callbacks

    Some hooks use opaque structs to keep internal state between callbacks.
    
    Because hooks ran sequentially (jobs == 1) with one command per hook,
    these internal states could be allocated on the stack for each hook run.
    
    Next commits add the ability to run multiple commands for each hook, so
    the states cannot be shared or stored on the stack anymore, especially
    since down the line we will also enable parallel execution (jobs > 1).
    
    Add alloc/free helpers for each hook, doing a "deep" alloc/init & free
    of their internal opaque struct.
    
    The alloc callback takes a context pointer, to initialize the struct at
    at the time of resource acquisition.
    
    These callbacks must always be provided together: no alloc without free
    and no free without alloc, otherwise a BUG() is triggered.
    
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    10ne1 authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    ee2fbfd View commit details
    Browse the repository at this point in the history
  2. hook: run a list of hooks to prepare for multihook support

    Hooks are limited to run one command (the default from the hookdir) for
    each event. This limitation makes it impossible to run multiple commands
    via config files, which the next commits will add.
    
    Implement the ability to run a list of hooks in hook.[ch]. For now, the
    list contains only one entry representing the "default" hook from the
    hookdir, so there is no user-visible change in this commit.
    
    All hook commands still run sequentially like before. A separate patch
    series will enable running them in parallel.
    
    Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    nasamuffin authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    4a36cb4 View commit details
    Browse the repository at this point in the history
  3. hook: add "git hook list" command

    The previous commit introduced an ability to run multiple commands for
    hook events and next commit will introduce the ability to define hooks
    from configs, in addition to the "traditional" hooks from the hookdir.
    
    Introduce a new command "git hook list" to make inspecting hooks easier
    both for users and for the tests we will add.
    
    Further commits will expand on this, e.g. by adding a -z output mode.
    
    Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    nasamuffin authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    9fdaa67 View commit details
    Browse the repository at this point in the history
  4. hook: include hooks from the config

    Teach the hook.[hc] library to parse configs to populate the list of
    hooks to run for a given event.
    
    Multiple commands can be specified for a given hook by providing
    "hook.<friendly-name>.command = <path-to-hook>" and
    "hook.<friendly-name>.event = <hook-event>" lines.
    
    Hooks will be started in config order of the "hook.<name>.event"
    lines and will be run sequentially (.jobs == 1) like before.
    Running the hooks in parallel will be enabled in a future patch.
    
    The "traditional" hook from the hookdir is run last, if present.
    
    A strmap cache is added to struct repository to avoid re-reading
    the configs on each rook run. This is useful for hooks like the
    ref-transaction which gets executed multiple times per process.
    
    Examples:
    
      $ git config --get-regexp "^hook\."
      hook.bar.command=~/bar.sh
      hook.bar.event=pre-commit
    
      # Will run ~/bar.sh, then .git/hooks/pre-commit
      $ git hook run pre-commit
    
    Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    10ne1 authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    03b4043 View commit details
    Browse the repository at this point in the history
  5. hook: allow disabling config hooks

    Hooks specified via configs are always enabled, however users
    might want to disable them without removing from the config,
    like locally disabling a global hook.
    
    Add a hook.<name>.enabled config which defaults to true and
    can be optionally set for each configured hook.
    
    Suggested-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    10ne1 authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    1ecce72 View commit details
    Browse the repository at this point in the history
  6. hook: allow event = "" to overwrite previous values

    Add the ability for empty events to clear previously set multivalue
    variables, so the newly added "hook.*.event" behave like the other
    multivalued keys.
    
    Suggested-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    10ne1 authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    d084fa2 View commit details
    Browse the repository at this point in the history
  7. hook: allow out-of-repo 'git hook' invocations

    Since hooks can now be supplied via the config, and a config can be
    present without a gitdir via the global and system configs, we can start
    to allow 'git hook run' to occur without a gitdir. This enables us to do
    things like run sendemail-validate hooks when running 'git send-email'
    from a nongit directory.
    
    It still doesn't make sense to look for hooks in the hookdir in nongit
    repos, though, as there is no hookdir.
    
    Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    nasamuffin authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    b51e238 View commit details
    Browse the repository at this point in the history
  8. hook: add -z option to "git hook list"

    Add a NUL-terminate mode to git hook list, just in case hooks are
    configured with weird characters like newlines in their names.
    
    Suggested-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    10ne1 authored and gitster committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    4b12cd3 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2026

  1. Merge branch 'ar/run-command-hook-take-2' into ar/config-hooks

    * ar/run-command-hook-take-2:
      builtin/receive-pack: avoid spinning no-op sideband async threads
    gitster committed Mar 3, 2026
    Configuration menu
    Copy the full SHA
    ec1c4d9 View commit details
    Browse the repository at this point in the history
Loading