Skip to content

post-merge hook does not appear to run in UI #22476

Open

Description

@etheranger

The problem

I have hooks set up in post-merge and post-checkout to update a workspace based on new files arriving.
It's good to know when it succeeds, but vital to know when it fails (basically an inconsistent workspace).

The dialog shows up when switching between branches (though only on failure, fair enough).
But it doesn't show up from pull or merge or update from master

As a trivial example, this hook does seem to run in the background, but there's no evidence of it failing to the end user:

#!/bin/sh
echo "Simulated error state"
echo "Bad data" > record.txt
exit 1

Release version

Version 3.6.2 (x64)

Operating system

Windows 10

Steps to reproduce the behavior

  1. Be on a local branch at least one commit behind its remote tracking branch.
Image
  1. add a hook that will exit nonzero to .git/hooks/post-merge:
#!/bin/sh
echo "Hook running"
echo "Hook ran" > record.txt
exit 1
  1. Press the Pull origin button.

  2. Note that the script ran (record.txt has been added to the workspace) but there was no UI warning of failure.

  3. To compare, copy the above hook to .git/hooks/post-checkout, then switch branches.

  4. Note that on switch, the UI does appear.

Image

Log files

2026-07-03.desktop.production.log

Screenshots

No response

Additional context

No response

Activity

  1. desktop-triage commented on Jul 8, 2026

    @desktop-triage

    Thanks for the detailed report! This looks like a bug in how Desktop handles hook failures during pull/merge operations. The post-checkout hook correctly surfaces failures in a UI dialog, but post-merge hook failures are silently swallowed — this inconsistency seems like an oversight in the hooks support that shipped in 3.5.x. I'm suggesting bug and priority-3 (affects users relying on post-merge hooks for workspace integrity, but core pull/merge operations still work and the hook does execute). No duplicates found — the general hooks tracking issue (#21501) is closed as completed, making this a specific gap report.

    Generated by Issue Triage (skills-driven) · 25.4 AIC · ⌖ 5.92 AIC · ⊞ 5.1K · ◷

  2. added
    bug
    priority-3
    on Jul 9, 2026
  3. shreeve commented on Sep 28, 2026

    @shreeve

    Hitting this too, from a slightly different angle, and I'd like to help fix it.

    I maintain a small tool that keeps encrypted secrets in a repo. Its post-merge and post-rewrite hooks keep each person's decrypted copies in sync after a pull. Most of the time that just works, but sometimes the hook needs the user to do something (two people changed the same secret, a key is missing), and the hook's output is the only way to tell them. In Desktop that output never shows up. On a failure it gets swallowed, as described above, and on success it's dropped too.

    It looks like most of the plumbing is already there. hooks-proxy.ts collects terminalOutput for every hook, and onHookProgress already reports finished and failed. It's just that post-merge, post-rewrite and friends are in ignoredOnFailureHooks, so they never reach the UI. Keeping them out of the "Hook failed" dialog makes sense, since the pull already happened and there's nothing to abort. But they still need somewhere to show up.

    What I have in mind is a small per-hook status list after any operation that ran hooks (commit, pull, merge, rebase, checkout):

    Pull origin · 2 hooks ran                                     ×
     ✅ post-merge     0.4s                                       ▸
     ❗ post-rewrite   0.2s                                       ▾
        │ two people changed config/app.env; run `sync --merge` to see both
        │ post-rewrite hook failed with code 1 after 0.20s
    
    • A green check or a red exclamation per hook, with its name and how long it took.
    • Click a row to expand or collapse its output, reusing the terminal output view the commit progress and "Hook failed" dialogs already use.
    • The whole thing is dismissible. To keep it quiet, it only appears when a hook failed or actually printed something.
    • Blocking hooks (pre-commit, pre-push, …) keep the existing dialog. This only covers the ones that can't stop the operation.

    That fixes this issue (post-merge failures become visible without a modal), and it also makes successful hooks that report something useful visible, which a lot of setups rely on (dependency installs after checkout, workspace syncs like the one above).

    If that direction sounds OK to you, I'm happy to put up a PR. Roughly: pass the output and exit code through onHookProgress for every hook, keep the last run's results per repository in the repository state cache, and render the list in the changes sidebar near the commit progress. Happy to adjust if you'd rather it live somewhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions