@@ -46,7 +46,7 @@ setupEnv = do
4646 let cdir = fromMaybe (home </> " .mcabal" ) cdirm
4747 env = Env { cabalDir = cdir, distDir = " dist-mcabal" , verbose = 0 , depth = 0 , eflags = [] ,
4848 backend = error " backend undefined" , recursive = False , targets = [TgtLib , TgtFor , TgtExe ],
49- gitRepo = Nothing , dryRun = False , useNightly = True , subDir = Nothing }
49+ gitRepo = Nothing , gitRef = Nothing , dryRun = False , useNightly = True , subDir = Nothing }
5050 be <- mhsBackend env
5151 return env{ backend = be }
5252
@@ -228,7 +228,7 @@ cmdFetch env [pkg] = do
228228 -- Doing a git fetch.
229229 -- With --git we will always fetch, blowing away the old repo.
230230 message env 1 $ " Fetching from git repo " ++ repo
231- gitClone env pdir (URL repo)
231+ gitClone env pdir (URL repo) ( GitRef <$> gitRef env)
232232cmdFetch _ _ = usage
233233
234234-----------------------------------------
@@ -385,6 +385,7 @@ addMissing sects = sects
385385
386386decodeGit :: (Env -> [String ] -> IO () ) -> Env -> [String ] -> IO ()
387387decodeGit io env (arg: args) | repo@ (Just _) <- stripPrefix " --git=" arg = decodeGit io (env{ gitRepo = repo }) args
388+ decodeGit io env (arg: args) | ref@ (Just _) <- stripPrefix " --git-ref=" arg = decodeGit io (env{ gitRef = ref }) args
388389decodeGit io env (arg: args) | dir@ (Just _) <- stripPrefix " --dir=" arg = decodeGit io (env{ subDir = dir }) args
389390decodeGit io env args = io env args
390391
@@ -473,14 +474,14 @@ installCFiles env glob (Section _ _ flds) = do
473474cmdHelp :: Env -> [String ] -> IO ()
474475cmdHelp _ _ = putStrLn " \
475476 \Available commands:\n \
476- \ mcabal [FLAGS] build [--git=URL [--dir=DIR]] [PKG] build in current directory, or the package PKG\n \
477- \ mcabal [FLAGS] test build and run tests in current directory\n \
478- \ mcabal [FLAGS] clean clean in the current directory\n \
479- \ mcabal [FLAGS] fetch [--git=URL [--dir=DIR]] PKG fetch files for package PKG\n \
480- \ mcabal [FLAGS] help show this message\n \
481- \ mcabal [FLAGS] install [--git=URL [--dir=DIR]] [PKG] build and install in current directory, or the package PKG\n \
482- \ mcabal [FLAGS] parse FILE just parse a Cabal file (for debugging)\n \
483- \ mcabal [FLAGS] update retrieve new set of consistent packages from Stackage\n \
477+ \ mcabal [FLAGS] build [--git=URL [--gitRef=REF] [-- dir=DIR]] [PKG] build in current directory, or the package PKG\n \
478+ \ mcabal [FLAGS] test build and run tests in current directory\n \
479+ \ mcabal [FLAGS] clean clean in the current directory\n \
480+ \ mcabal [FLAGS] fetch [--git=URL [--dir=DIR]] PKG fetch files for package PKG\n \
481+ \ mcabal [FLAGS] help show this message\n \
482+ \ mcabal [FLAGS] install [--git=URL [--dir=DIR]] [PKG] build and install in current directory, or the package PKG\n \
483+ \ mcabal [FLAGS] parse FILE just parse a Cabal file (for debugging)\n \
484+ \ mcabal [FLAGS] update retrieve new set of consistent packages from Stackage\n \
484485 \\n \
485486 \Flags:\n \
486487 \ --version show version\n \
0 commit comments