Commit 2d10a5774dbb7a387dae0ac4aeb79c579865c865
git/config: wta and wtas for worktree add without and with submodules
* wta: worktree add with defaults that prevent trouble: * --no-checkout: Maybe we don't want HEAD. Don't waste time checking it out. * --detach: We don't want a branch. Otherwise it creates a branch with the same name as the destination and it might already exist and everybody gets upset. * wtas: add worktree and wta repo's submodules into it: * Go through HEAD:.gitmodules, check if modules exist in repo and if they do, add worktrees in the properly mapped places. * That Python code is abspath() rooted on bash's PWD -- no surprise dereferencing of symlinks.Claes Wallin (韋嘉誠) committed on 3/29/2017, 1:58:31 PM
Parent: bfb1992581a77d2518cfbad01a611d4d6e11f298
Files changed
.config/git/config | changed |
.config/git/config | ||
---|---|---|
@@ -7,8 +7,10 @@ | ||
7 | 7 … | amend = commit --amend --no-edit --reset-author |
8 | 8 … | gco = !bash -c 'git fetch gerrit \"$1\" && git checkout FETCH_HEAD' git-gco |
9 | 9 … | fc = "!bash -ec 'change=\"$1\"; prefix=\"${change:3:2}\"; git fetch gerrit \"refs/changes/${prefix}/${change}/*:refs/remotes/gerrit/changes/${prefix}/${change}/*\"' git-fc" |
10 | 10 … | cc = "!bash -ec 'change=\"$1\"; prefix=\"${change:3:2}\"; git fc \"$change\"; latest=$(git ls-remote . \"refs/remotes/gerrit/changes/${prefix}/${change}/*\" | sort -n -t / -k 7 | cut -f 2 | tail -n 1); if [[ -z $latest ]]; then echo >&2 \"No such change: $change\"; exit 1; else git checkout \"$latest\"; fi' git-cc" |
11 … | + wta = worktree add --no-checkout --detach | |
12 … | + wtas = "!bash -ec 'if (( $# != 1)); then echo >&2 git wtas: 1 parameter expected; exit 2; fi; tree=\"$(python -c \"from __future__ import print_function; import os, os.path, sys; print(os.path.normpath(os.path.join(os.getenv(\\\"PWD\\\"), sys.argv[1])))\" \"$1\")\"; git wta \"$tree\"; cd \"$(git rev-parse --git-dir)\"; for mod in $(git config --blob HEAD:.gitmodules -l --name-only|gawk -F . \"/\\.path$/ {print \\$2}\"); do [ -d modules/$mod ] && git -C modules/$mod wta \"${tree}/$(git config --blob HEAD:.gitmodules --get submodule.${mod}.path)\"; done' wtas" | |
11 | 13 … | |
12 | 14 … | [core] |
13 | 15 … | autocrlf = false |
14 | 16 … | safecrlf = true |
Built with git-ssb-web