diff --git a/dim b/dim index f7747177c7cc07b97c46d6d64477c36842e57a1c..7fee7060847861275d495d86bfee53f1167cfeac 100755 --- a/dim +++ b/dim @@ -53,6 +53,10 @@ fi # prefix for repo directories DIM_PREFIX=${DIM_PREFIX:-$HOME/linux} +# location of another dim setup used to speedup clones; default +# to something that doesn't exist so no cache is used +DIM_KERNEL_PREFIX=${DIM_KERNEL_REFERENCE:-/dev/fd/-1} + # main maintainer repo under $DIM_PREFIX DIM_REPO=${DIM_REPO:-${DIM_DRM_INTEL:-src}} @@ -2321,7 +2325,7 @@ function parse_opt_dim_setup # options { local OPTS arg - OPTS=$(getopt --option y --long yes -n 'dim setup' -- "$@") + OPTS=$(getopt --option y --long yes,reference: -n 'dim setup' -- "$@") eval set -- "$OPTS" @@ -2331,6 +2335,10 @@ function parse_opt_dim_setup # options ASK_USER_ASSUME_YES=1 shift ;; + --reference) + DIM_KERNEL_REFERENCE=$2 + shift 2 + ;; --) shift; break ;; esac @@ -2361,7 +2369,8 @@ function dim_setup # options if [[ ! -d "$DIM_REPO" ]]; then if ask_user "The DIM_REPO maintainer kernel repository '$DIM_REPO' doesn't exist. Clone upstream?"; then - git clone "$linux_upstream_git" "$DIM_REPO" + git clone --reference-if-able "$DIM_KERNEL_REFERENCE" --dissociate \ + "$linux_upstream_git" "$DIM_REPO" fi fi diff --git a/dim.rst b/dim.rst index ede150fa02bb7cd2b684ad437ae3a77edd10e930..001eb9327670cfe40a572099524a3ff29efade69 100644 --- a/dim.rst +++ b/dim.rst @@ -120,6 +120,13 @@ Available options: Assume "yes" to all prompts or default values so it can be executed non-attended +--reference <directory> + Use another kernel checkout to borrow the git objects + from while cloning so it reduces the network transfer + amount. The final repo is then dissociated from the + passed reference. See --reference and --dissociate in + GIT-CLONE(1). + update-branches --------------- Updates all maintainer branches. Useful to synchronize all branches when other