Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mergiraf: init module #6633

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bobvanderlinden
Copy link

Description

This adds git integration for mergiraf. It sets up git to use mergiraf to automatically resolve merge conflicts. See https://mergiraf.org/usage.html#registration-as-a-git-merge-driver

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all
    or nix build --reference-lock-file flake.lock ./tests#test-all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

This adds git integration for mergiraf. It sets up git to use mergiraf
to automatically resolve merge conflicts.
Comment on lines +30 to +33
xdg.configFile."git/attributes".source =
pkgs.runCommand "mergiraf-git-attributes" { } ''
${mergiraf} languages --gitattributes > $out
'';
Copy link
Author

@bobvanderlinden bobvanderlinden Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I'm unsure of. Right now, it'll conflict if someone has set programs.git.attributes. It does update all language settings automatically.

Alternative 1: hard-coding the languages into programs.git.attributes, but we need to keep this list up-to-date, which is less than ideal.

Alternative 2: using mkDefault, but this will likely unintendedly remove the core mergiraf configuration.

Alternative 3: allowing programs.git.attributes to also include other files and concat it all. This will add somewhat complex functionality to the git module, so I'm unsure whether this is wanted for now.

@bobvanderlinden
Copy link
Author

bobvanderlinden commented Mar 14, 2025

Ping @wetneb, this adds integration for mergiraf into home-manager, so that users can simply enable programs.mergiraf.enable = true; and have the merge config and attributes be setup and be updated automatically.

@bobvanderlinden
Copy link
Author

I'm unsure why the test for macos is failing. The package name @mergiraf@ isn't being used and instead /nix/store/* is used somehow 😕

Any suggestions?

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.

1 participant