-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Add --no-submodules option to suppress fetching submodules (e.g. git). #370
Conversation
The travis failure is an |
src/Distribution/Nixpkgs/Fetch.hs
Outdated
fetchers :: Source -> MaybeT IO (DerivationSource, a) | ||
fetchers source = msum . (fetchLocal source :) $ map (\fetcher -> fetchWith fetcher source >>= process) | ||
[ (False, "url", []) | ||
, (True, "git", ["--fetch-submodules"]) | ||
, (True, "git", if s then ["--fetch-submodules"] else []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO if you name s
a bit more descriptively like optSubmodules
which is also consistent with the call site then the hlint suggestion of using:
[ "--fetch-submodules" | optSubmodules ]
is quite clear and understandable. It's a bit like the optional
function in Nix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good suggestion, thank you.
src/Cabal2nix.hs
Outdated
@@ -90,6 +91,7 @@ options = Options | |||
<*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format")) | |||
<*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i]))) | |||
<*> strArgument (metavar "URI") | |||
<*> flag True False (long "no-submodules" <> help "don't fetch git submodules") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last nitpick: what about naming the flag
--dont-fetch-submodules
?
Since that name is more consistent with the flag we disable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally dislike the "dont" terminology which drops the apostrophe, but --do-not-fetch-submodules
gets even wordier. In this case though I accede to the utility of consistency in the terminology.
Thank you! |
There are times when submodule fetching is unnecessary (e.g. the submodules will be built as separate nix packages), so it would be nice to suppress this for git repos with extensive or recursive submodules. This patch leaves the default behavior to fetch the submodules, but adds an option to disable that.