Skip to content

Guard MergeNB against merge.tool=nbdime and provide terminal-ready remediation#85

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-nbdime-check-to-git-integration
Draft

Guard MergeNB against merge.tool=nbdime and provide terminal-ready remediation#85
Copilot wants to merge 3 commits intomainfrom
copilot/add-nbdime-check-to-git-integration

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

MergeNB currently cannot safely operate in the same merge flow when Git is configured with merge.tool=nbdime. This PR adds an explicit compatibility check and gives users copy/paste terminal guidance to disable that configuration before resolving notebook conflicts.

  • Activation-time compatibility guard

    • Added ensureSupportedMergeTool(...) in gitIntegration.ts.
    • It reads git config --get merge.tool for the active repo and detects nbdime.
    • On detection, it throws a dedicated UnsupportedMergeToolError.
  • User-facing remediation path

    • Added a one-time VS Code error prompt for the repo root when nbdime is detected.
    • Prompt action opens a terminal prefilled with pasteable commands to unset merge.tool, remove mergetool.nbdime config, and optionally uninstall nbdime.
  • Early wiring in extension lifecycle

    • Hooked the guard into activate(...) in extension.ts so users are notified immediately, before entering MergeNB conflict resolution flow.
  • Implementation details

    • Uses repo-scoped deduping (Set) to avoid repeated warnings in the same workspace.
    • Non-fatal handling for unset merge.tool (expected git config --get exit behavior).
const { stdout } = await execAsync('git config --get merge.tool', { cwd: gitRoot });
const mergeTool = stdout.trim().toLowerCase();

if (mergeTool === 'nbdime') {
  const error = new UnsupportedMergeToolError(gitRoot, mergeTool);
  await showUnsupportedMergeToolGuidance(error);
  throw error;
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node out/tests/runIntegrationTest.js --test takeAll_base (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>On use, check if mergetool == nbdime and throw error in gitIntegration.ts.</issue_title>
<issue_description>Give directions to unset it/uninstall as a pastable popup in terminal</issue_description>

<agent_instructions>Follow the guidelines, and incorporate something similar as a check on activating nbdime.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 13, 2026 02:16
Co-authored-by: Avni2000 <77120766+Avni2000@users.noreply.github.com>
Co-authored-by: Avni2000 <77120766+Avni2000@users.noreply.github.com>
Copilot AI changed the title [WIP] Add check for mergetool in gitIntegration.ts Guard MergeNB against merge.tool=nbdime and provide terminal-ready remediation Feb 13, 2026
Copilot AI requested a review from Avni2000 February 13, 2026 02:20
@Avni2000
Copy link
Owner

Some intricacies the AI's not aware of -

  1. git config --list is global. git config --local --list is local
  2. We can unset with regex from "jupyter/ipynb/nbdiff/nbdime" etc. with git config --global (or --local) -- unset {command}
  3. We may not even have to do all this stuff about asking to have people paste it (though it's a good source of friction, kinda like sudo) if we just check the git API in vscode or custom make one. (this is complicated)

@Avni2000
Copy link
Owner

We should also make a proper test for this, since I know for a fact it'll be the source of a lot of complaints

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On use, check if mergetool == nbdime and throw error in gitIntegration.ts.

2 participants