NixOS / NixOS/hydra

nix-prefetch-git incorrectly matches similar submodule urls

Open
#482 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PLpgSQL
Stars
1.6k
Forks
358
Avg merge
20h 30m
Merged PRs (30d)
27

Description

Given a project with similarly named submodules, the nix-prefetch-git function init_submodules improperly extracts the submodule repo URL.

For example, a sample output of git submodule status would report:

-ad7be1b00addf4d077f7dfbf5aea34ffd5e16007 hs-foobar
-e862490c2b61c49cd7138f77eaa0ada08e4b3d0b foobar

for two submodules: foobar and hs-foobar.

The sample .git/config would look like this:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = git@github:me/something.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[submodule "hs-foobar"]
        active = true
        url = git@github.com:him/hs-foobar.git
[submodule "foobar"]
        active = true
        url = git@github.com:her/foobar.git

When nix-prefetch-git is run by hydra, it will improperly report the URL of the foobar submodule as git@github.com:him/hs-foobar.git. The expected URL is git@github.com:her/foobar.git.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the nix-prefetch-git function named init_submodules and reproduce the case with the two similarly named submodules and the shown .git/config. The fix is complete when the foobar submodule resolves to git@github.com:her/foobar.git rather than the hs-foobar URL; check the Hydra or nix-prefetch-git test coverage if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.