update-nix-fetchgit 0.2.4 → 0.2.5
raw patch · 4 files changed
+20/−8 lines, 4 files
Files
- CHANGELOG.md +5/−0
- package.yaml +1/−1
- src/Update/Nix/FetchGit/Prefetch.hs +13/−6
- update-nix-fetchgit.cabal +1/−1
CHANGELOG.md view
@@ -2,6 +2,11 @@ ## WIP +## [0.2.5] - 2020-11-14++- Pass `--heads --tags` to `git ls-remote` to avoid fetching remote+ refs. Don't pass when the revision begins with `refs`+ ## [0.2.4] - 2020-11-11 - Add --dry-run option
package.yaml view
@@ -1,5 +1,5 @@ name: update-nix-fetchgit-version: "0.2.4"+version: "0.2.5" synopsis: A program to update fetchgit values in Nix expressions description: | This command-line utility is meant to be used by people maintaining Nix
src/Update/Nix/FetchGit/Prefetch.hs view
@@ -103,16 +103,23 @@ | otherwise -> pure hash Nothing -> refute1 $ NoSuchRef (unRevision revision) --- | Run git ls-remote --sort=-v:refname and return the first match if any+-- | Run git ls-remote --heads --tags --sort=-v:refname and return the first+-- match if any. Use '--heads --tags' if the revision doesn't start with+-- 'refs/' to avoid getting 'remote' refs. gitLsRemotes :: Text -> Revision -> M (Maybe (Text, Text)) gitLsRemotes repo revision = do+ let headsTags = if T.isPrefixOf "refs/" (unRevision revision)+ then []+ else ["--heads", "--tags"] (exitCode, nsStdout, nsStderr) <- liftIO $ readProcessWithExitCode "git"- [ "ls-remote"- , "--sort=-v:refname"- , T.unpack repo- , T.unpack (unRevision revision)- ]+ ( [ "ls-remote"+ , "--sort=-v:refname"+ , T.unpack repo+ , T.unpack (unRevision revision)+ ]+ <> headsTags+ ) "" case exitCode of ExitFailure e -> refute1 (NixPrefetchGitFailed e (pack nsStderr))
update-nix-fetchgit.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: update-nix-fetchgit-version: 0.2.4+version: 0.2.5 synopsis: A program to update fetchgit values in Nix expressions description: This command-line utility is meant to be used by people maintaining Nix expressions that fetch files from Git repositories. It automates the process