git ssb

0+

clacke / gists



Commit c7b2d0bce3b000f41b31dc1decd3e89822e355b7

git/config: cc fc: Don't assume how long the change number is.

Probably still breaks if it's shorter than three. I don't know how
gerrit lays things out for shorter numbers.
Claes Wallin (韋嘉誠) committed on 4/4/2017, 3:58:18 PM
Parent: 0c4a0b6e10f7fbf15127339750a6ff490d9aa3c8

Files changed

.config/git/configchanged
.config/git/configView
@@ -5,10 +5,11 @@
55 lr = log --walk-reflogs --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'
66 st = status --short
77 amend = commit --amend --no-edit --reset-author
88 gco = !bash -c 'git fetch gerrit \"$1\" && git checkout FETCH_HEAD' git-gco
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- 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"
9 + fc = "!bash -ec 'change=\"$1\"; prefix=\"${change:$((${#change} - 2)):2}\"; git fetch gerrit \"refs/changes/${prefix}/${change}/*:refs/remotes/gerrit/changes/${change}/*\"' git-fc"
10 + cc = "!bash -ec 'change=\"$1\"; prefix=\"${change:$((${#change} - 2)):2}\"; git fc \"$change\"; latest=$(git ls-remote . \"refs/remotes/gerrit/changes/${change}/*\" | sort -n -t / -k 6 | 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 +
1112 wta = worktree add --detach
1213 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"
1314
1415 [core]

Built with git-ssb-web