config/git: clean up, incorporating moves with gcn

This commit is contained in:
xeruf 2021-11-23 10:20:04 +01:00
parent 7ef49491db
commit 6a437be8af
5 changed files with 8 additions and 22 deletions

View File

@ -82,7 +82,7 @@
# status # status
s = !git stl && git stb s = !git stl && git stb
st = stb . st = stb .
stb = status --short --branch stb = status --short --branch --find-renames=.2
sv = --paginate status -v sv = --paginate status -v
svv = --paginate status -vv svv = --paginate status -vv
@ -190,6 +190,3 @@
[includeIf "gitdir:yadm/repo.git"] [includeIf "gitdir:yadm/repo.git"]
path = "~/.config/yadm/gitconfig" path = "~/.config/yadm/gitconfig"
[includeIf "gitdir:~/data/.git"]
path = "config-data"

View File

@ -1,4 +0,0 @@
[alias]
journal = !git add $(git root)/2-standards/notes/journal && git cme "notes/journal:" $(git root)/2-standards/notes/journal
note = !git cme "notes:" $(git root)/2-standards/notes
write = !git add $(git root)/2-standards/writing && git cme "write:" $(git root)/2-standards/writing

View File

@ -21,15 +21,17 @@ gcn() {
fulldir="$(realpath ${1:-$PWD})" fulldir="$(realpath ${1:-$PWD})"
dir="${fulldir#$root/*/}" dir="${fulldir#$root/*/}"
else else
dir="notes/$1" dir="box/$1"
fulldir="$root/2-standards/$dir" fulldir="$root/2-standards/$dir"
fi fi
else else
fulldir="$(realpath ${1:-$PWD})" fulldir="$(realpath ${1:-$PWD})"
dir="${fulldir#$root/}" dir="${fulldir#$root/}"
fi fi
echo "$dir:" >/tmp/gcn-msg echo "$dir: " >/tmp/gcn-msg
git commit -v --template /tmp/gcn-msg ${@:2} -- $fulldir git add $fulldir
git moves -q
git commit -v --template /tmp/gcn-msg ${@:2} #-- $fulldir
} }
# if in home or under XDG_CONFIG_HOME and not within a git directory, replace git by yadm # if in home or under XDG_CONFIG_HOME and not within a git directory, replace git by yadm
@ -67,15 +69,6 @@ gitretag() {
git push origin refs/tags/${1}:refs/tags/${2} :refs/tags/$1 && git tag -d $1 git push origin refs/tags/${1}:refs/tags/${2} :refs/tags/$1 && git tag -d $1
} }
# Open or select a project
project() {
cd $projects_dir
if [ -d $2 ]
then cd "$2" && gitorigin "$@"
else gitclone "$@"
fi
}
# Rewriting history {{{ # Rewriting history {{{
# gets the AuthorDate of a given committish # gets the AuthorDate of a given committish

View File

@ -1,5 +1,5 @@
[alias] [alias]
cgit = !yadm cme "config/git:" $XDG_CONFIG_HOME/git $CONFIG_SHELLS/git $HOME/.local/bin/scripts/git-* cgit = !yadm cme "config/git:" $XDG_CONFIG_HOME/git $CONFIG_SHELLS/git $HOME/.local/bin/scripts/git-*
cf = !yadm cme "bin:" $CONFIG_SHELLS/functions $HOME/.local/bin/scripts
cshell = !yadm cme "config/shell:" $CONFIG_SHELLS $HOME/.zprofile cshell = !yadm cme "config/shell:" $CONFIG_SHELLS $HOME/.zprofile
cf = !yadm cme "bin:" $CONFIG_SHELLS/functions $HOME/.local/bin/scripts
cbin = !yadm cme "bin:" $HOME/.local/bin/scripts cbin = !yadm cme "bin:" $HOME/.local/bin/scripts

View File

@ -6,4 +6,4 @@ git add "$root"
git status --porcelain --find-renames=.2 | git status --porcelain --find-renames=.2 |
grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' | grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' |
xargs git -C "$root" restore --staged xargs git -C "$root" restore --staged
git status -s --find-renames=.2 test "$1" = "-q" || git status --short --find-renames=.2