diff options
| author | ruki <[email protected]> | 2020-01-21 00:42:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-01-20 22:16:17 +0800 |
| commit | ab317d02fb8442204813b5b66457406498e48c1c (patch) | |
| tree | 3d21588850e41b8a613ac62d1e3f34e5c2e35687 | |
| parent | f07af69d4ed8474302ecd016ab5fec71a658c58f (diff) | |
add shallow-submodules for git
| -rwxr-xr-x | scripts/get.sh | 15 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/devel/git/clone.lua | 8 |
3 files changed, 14 insertions, 15 deletions
diff --git a/scripts/get.sh b/scripts/get.sh index fa74379d9..fce123a23 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -98,7 +98,7 @@ install_tools() } test_tools || { install_tools && test_tools; } || my_exit "$(echo -e 'Dependencies Installation Fail\nThe getter currently only support these package managers\n\t* apt\n\t* yum\n\t* zypper\n\t* pacman\nPlease install following dependencies manually:\n\t* git\n\t* build essential like `make`, `gcc`, etc\n\t* libreadline-dev (readline-devel)\n\t* ccache (optional)')" 1 branch=master -mirror=tboox +mirror=xmake-io IFS=':' if [ x != "x$1" ]; then brancharr=($1) @@ -116,12 +116,12 @@ fi projectdir=$tmpdir if [ 'x__local__' != "x$branch" ]; then if [ x != "x$2" ]; then - git clone --depth=50 -b "$branch" "https://github.com/$mirror/xmake.git" --recursive $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')" + git clone --depth=50 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')" cd $projectdir || my_exit 'Chdir Error' git checkout -qf "$2" cd - || my_exit 'Chdir Error' else - git clone --depth=1 -b "$branch" "https://github.com/$mirror/xmake.git" --recursive $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')" + git clone --depth=1 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules --shallow-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')" fi else if [ -d '.git' ]; then @@ -167,34 +167,25 @@ install_profile() echo ' if [[ "$SHELL" = */zsh ]]; then # zsh parameter completion for xmake - _xmake_zsh_complete() { local completions=("$(XMAKE_SKIP_HISTORY=1 xmake lua --root private.utils.complete 0 nospace "$words")") - reply=( "${(ps:\n:)completions}" ) } - compctl -f -S "" -K _xmake_zsh_complete xmake - elif [[ "$SHELL" = */bash ]]; then # bash parameter completion for xmake - _xmake_bash_complete() { local word=${COMP_WORDS[COMP_CWORD]} - local completions completions="$(XMAKE_SKIP_HISTORY=1 xmake lua --root private.utils.complete "${COMP_POINT}" "conf" "${COMP_LINE}" 2>/dev/null)" if [ $? -ne 0 ]; then completions="" fi - COMPREPLY=( $(compgen -W "$completions" -- "$word") ) } - complete -o default -o nospace -F _xmake_bash_complete xmake - fi ' >> ~/.xmake/profile diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index 65b4bd720..10323b438 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -321,7 +321,7 @@ function sandbox_os.vrun(cmd, ...) end -- run it - utils.ifelse(option.get("verbose"), sandbox_os.exec, sandbox_os.run)(cmd, ...) + (option.get("verbose") and sandbox_os.exec or sandbox_os.run)(cmd, ...) end -- quietly run command with arguments list and echo verbose info if [-v|--verbose] option is enabled @@ -329,11 +329,11 @@ function sandbox_os.vrunv(program, argv, opt) -- echo command if option.get("verbose") then - print(vformat(program) .. " " .. table.concat(argv, " ")) + print(vformat(program) .. " " .. sandbox_os.args(argv)) end -- run it - utils.ifelse(option.get("verbose"), sandbox_os.execv, sandbox_os.runv)(program, argv, opt) + (option.get("verbose") and sandbox_os.execv or sandbox_os.runv)(program, argv, opt) end -- run command and return output and error data diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua index 027cc9317..b8fca2b48 100644 --- a/xmake/modules/devel/git/clone.lua +++ b/xmake/modules/devel/git/clone.lua @@ -62,6 +62,14 @@ function main(url, opt) table.insert(argv, "--recursive") end + -- clone for submodules + if opt.recurse_submodules then + table.insert(argv, "--recurse-submodules") + end + if opt.shallow_submodules then + table.insert(argv, "--shallow-submodules") + end + -- set outputdir if opt.outputdir then table.insert(argv, path.translate(opt.outputdir)) |
