Skip to content

Instantly share code, notes, and snippets.

@zwimer
Created October 28, 2024 15:13
Show Gist options
  • Save zwimer/e94381b2754dd2605b2516d15b423ca5 to your computer and use it in GitHub Desktop.
Save zwimer/e94381b2754dd2605b2516d15b423ca5 to your computer and use it in GitHub Desktop.

Revisions

  1. zwimer created this gist Oct 28, 2024.
    38 changes: 38 additions & 0 deletions blame.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
    index 0397dec64d..f9cce044fe 100644
    --- a/Documentation/githooks.txt
    +++ b/Documentation/githooks.txt
    @@ -758,6 +758,12 @@ and "0" meaning they were not.
    Only one parameter should be set to "1" when the hook runs. The hook
    running passing "1", "1" should not be possible.

    +pre-blame
    +~~~~~~~~~~~~~~
    +
    +This hook is run before git blame; the exit code is ignored.
    +
    +
    SEE ALSO
    --------
    linkgit:git-hook[1]
    diff --git a/builtin/blame.c b/builtin/blame.c
    index e407a22da3..ac81dddb26 100644
    --- a/builtin/blame.c
    +++ b/builtin/blame.c
    @@ -17,6 +17,7 @@
    #include "revision.h"
    #include "quote.h"
    #include "string-list.h"
    +#include "hook.h"
    #include "mailmap.h"
    #include "parse-options.h"
    #include "prio-queue.h"
    @@ -966,6 +967,8 @@ int cmd_blame(int argc,
    revs.diffopt.flags.follow_renames = 0;
    argc = parse_options_end(&ctx);

    + run_hooks(the_repository, "pre-blame");
    +
    prepare_repo_settings(the_repository);
    the_repository->settings.command_requires_full_index = 0;