config/git: fix sysyadm & add diffa

This commit is contained in:
xeruf 2021-10-14 20:25:44 +02:00
parent b08c4e0c3f
commit 8b36d80d5e
4 changed files with 17 additions and 6 deletions

View File

@ -13,11 +13,17 @@ yc() {
} }
alias sysyadm="yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm" alias sysyadm="yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm"
alias sysinit="sysyadm init -b main -w /; sysyadm gitconfig include.path '$XDG_CONFIG_HOME/git/config'" alias sysinit="sysyadm init -b main -w /" #; sysyadm gitconfig include.path '$XDG_CONFIG_HOME/git/config'"
sy() { sy() {
unignore="/etc/yadm/unignore" unignore="/etc/yadm/unignore"
test -r "$unignore" && cat "$unignore" | envsubst | sysyadm add --intent-to-add --pathspec-from-file=- test -r "$unignore" && cat "$unignore" | envsubst | sysyadm add --intent-to-add --pathspec-from-file=-
test "$#" -eq 0 && sysyadm s || sysyadm "$@" case "$1" in
("") sysyadm s;;
(p) sysyadm p;;
(l) sysyadm fetch && sy rebase main --onto origin/main;;
(*) sudo -E $(alias sysyadm | cut -d\' -f2) "$@";;
esac
sudo chown -R $USER /etc/yadm
} }
gcn() { gcn() {

3
.local/bin/scripts/git-diffa Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
# Diff given files against all branches
git for-each-ref --format='%(refname:short)' | while read branch; do { highlight $branch && git diff --color=always $branch..HEAD "$@"; }; done | less

View File

@ -1,9 +1,11 @@
#!/bin/sh -e #!/bin/sh -e
# set repo as origin and set all branches upstream to a corresponding remote branch, if available # set repo as origin and set all branches upstream to a corresponding remote branch, if available
git remote remove origin 2>/dev/null git remote $(case "$(git remote)" in
git remote add origin $(git-repo "$@") (*origin*) echo set-url;;
(*) echo add;;
esac) origin "$(git-repo "$@")"
git remote -v && git fetch git remote -v && git fetch
git branch | sed 's/ //g' | sed 's/*//' | while read branch git branch --format='%(refname:short)' | while read branch
do test $(git branch -a | grep origin/$branch | wc -l) -gt 0 && git branch -u origin/$branch $branch do test $(git branch -a | grep origin/$branch | wc -l) -gt 0 && git branch -u origin/$branch $branch
done done

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
# Commits by myself throughout the current week # Commits by myself throughout the current week
# Depends on git-my alias listing commits by myself # depends: git-my alias - listing own commits
git my --after "$(date -d "Mon ${1:-1} weeks ago")" --before "$(date -d "Mon $(expr ${1:-1} - 1) weeks ago")" "${@:2}" git my --after "$(date -d "Mon ${1:-1} weeks ago")" --before "$(date -d "Mon $(expr ${1:-1} - 1) weeks ago")" "${@:2}"