Fixes cloning of default git branches.
When cloning a git repo the default branch will now be cloned. Had to revert #70 for this. Sorry @gradha.
This commit is contained in:
parent
3a66241a22
commit
1234cdce13
1 changed files with 4 additions and 15 deletions
|
|
@ -31,7 +31,7 @@ proc doCheckout(meth: DownloadMethod, downloadDir, branch: string) =
|
||||||
proc doPull(meth: DownloadMethod, downloadDir: string) =
|
proc doPull(meth: DownloadMethod, downloadDir: string) =
|
||||||
case meth
|
case meth
|
||||||
of DownloadMethod.git:
|
of DownloadMethod.git:
|
||||||
doCheckout(meth, downloadDir, "master")
|
doCheckout(meth, downloadDir, "")
|
||||||
cd downloadDir:
|
cd downloadDir:
|
||||||
doCmd("git pull")
|
doCmd("git pull")
|
||||||
if existsFile(".gitmodules"):
|
if existsFile(".gitmodules"):
|
||||||
|
|
@ -47,20 +47,9 @@ proc doClone(meth: DownloadMethod, url, downloadDir: string, branch = "",
|
||||||
of DownloadMethod.git:
|
of DownloadMethod.git:
|
||||||
let
|
let
|
||||||
depthArg = if tip: "--depth 1 " else: ""
|
depthArg = if tip: "--depth 1 " else: ""
|
||||||
branchArg = if branch == "": "-b origin/master" else: "-b " & branch & " "
|
branchArg = if branch == "": "" else: "-b " & branch & " "
|
||||||
branch = if branch == "": "master" else: branch
|
doCmd("git clone --recursive " & depthArg & branchArg & url &
|
||||||
# Some git versions (e.g. 1.7.9.5) don't check out the correct branch/tag
|
" " & downloadDir)
|
||||||
# directly during clone, so we enter the download directory and manually
|
|
||||||
# initi the git repo issuing several commands in sequence. Recipe taken
|
|
||||||
# from http://stackoverflow.com/a/3489576/172690.
|
|
||||||
downloadDir.createDir
|
|
||||||
downloadDir.cd:
|
|
||||||
doCmd("git init")
|
|
||||||
doCmd("git remote add origin " & url)
|
|
||||||
doCmd("git fetch origin " & depthArg & branch)
|
|
||||||
doCmd("git reset --hard FETCH_HEAD")
|
|
||||||
doCmd("git checkout --force " & branchArg)
|
|
||||||
doCmd("git submodule update --init --recursive")
|
|
||||||
of DownloadMethod.hg:
|
of DownloadMethod.hg:
|
||||||
let
|
let
|
||||||
tipArg = if tip: "-r tip " else: ""
|
tipArg = if tip: "-r tip " else: ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue