File tree 4 files changed +20
-8
lines changed
4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## WIP
4
4
5
+ ## [ 0.2.5] - 2020-11-14
6
+
7
+ - Pass ` --heads --tags ` to ` git ls-remote ` to avoid fetching remote
8
+ refs. Don't pass when the revision begins with ` refs `
9
+
5
10
## [ 0.2.4] - 2020-11-11
6
11
7
12
- Add --dry-run option
Original file line number Diff line number Diff line change 1
1
name : update-nix-fetchgit
2
- version : " 0.2.4 "
2
+ version : " 0.2.5 "
3
3
synopsis : A program to update fetchgit values in Nix expressions
4
4
description : |
5
5
This command-line utility is meant to be used by people maintaining Nix
Original file line number Diff line number Diff line change @@ -103,16 +103,23 @@ getGitRevision repo revision = do
103
103
| otherwise -> pure hash
104
104
Nothing -> refute1 $ NoSuchRef (unRevision revision)
105
105
106
- -- | Run git ls-remote --sort=-v:refname and return the first match if any
106
+ -- | Run git ls-remote --heads --tags --sort=-v:refname and return the first
107
+ -- match if any. Use '--heads --tags' if the revision doesn't start with
108
+ -- 'refs/' to avoid getting 'remote' refs.
107
109
gitLsRemotes :: Text -> Revision -> M (Maybe (Text , Text ))
108
110
gitLsRemotes repo revision = do
111
+ let headsTags = if T. isPrefixOf " refs/" (unRevision revision)
112
+ then []
113
+ else [" --heads" , " --tags" ]
109
114
(exitCode, nsStdout, nsStderr) <- liftIO $ readProcessWithExitCode
110
115
" git"
111
- [ " ls-remote"
112
- , " --sort=-v:refname"
113
- , T. unpack repo
114
- , T. unpack (unRevision revision)
115
- ]
116
+ ( [ " ls-remote"
117
+ , " --sort=-v:refname"
118
+ , T. unpack repo
119
+ , T. unpack (unRevision revision)
120
+ ]
121
+ <> headsTags
122
+ )
116
123
" "
117
124
case exitCode of
118
125
ExitFailure e -> refute1 (NixPrefetchGitFailed e (pack nsStderr))
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ cabal-version: 1.12
5
5
-- see: https://github.com/sol/hpack
6
6
7
7
name : update-nix-fetchgit
8
- version : 0.2.4
8
+ version : 0.2.5
9
9
synopsis : A program to update fetchgit values in Nix expressions
10
10
description : This command-line utility is meant to be used by people maintaining Nix
11
11
expressions that fetch files from Git repositories. It automates the process
You can’t perform that action at this time.
0 commit comments