mirror of
https://github.com/gaschz/dotfiles.git
synced 2025-03-01 14:22:33 +01:00
fix: escape newline characters in git aliases
When 'git config --get "alias.*"' is run, it expands especial characters breaking the retrieval of aliases and assignment for shell aliases starting the g for git.
This commit is contained in:
parent
7659897283
commit
b025ea0fea
@ -23,7 +23,8 @@
|
|||||||
ci = commit
|
ci = commit
|
||||||
cia = commit --amend
|
cia = commit --amend
|
||||||
cian = commit --amend --no-edit
|
cian = commit --amend --no-edit
|
||||||
cir = "!sh -c 'file=\"$(git rev-parse --git-dir)/COMMIT_EDITMSG\"; if test -s \"$file\"; then git commit -eF \"$file\" \"$@\"; else git commit \"$@\"; fi'" -
|
cir = "!sh -c 'file=\"$(git rev-parse --git-dir)/COMMIT_EDITMSG\"; \
|
||||||
|
if test -s \"$file\"; then git commit -eF \"$file\" \"$@\"; else git commit \"$@\"; fi'" -
|
||||||
lg = !sh -c 'git log --color \"$@\"|fmt -s -w 79|less -FRSX' _
|
lg = !sh -c 'git log --color \"$@\"|fmt -s -w 79|less -FRSX' _
|
||||||
lgg = log --graph --pretty='format:%C(yellow)%h%C(reset) %C(magenta)%G?%C(reset) -%C(red)%d%C(reset) %C(reset)%s %C(green)(%cs)%C(reset) %C(blue)%aN%C(reset)'
|
lgg = log --graph --pretty='format:%C(yellow)%h%C(reset) %C(magenta)%G?%C(reset) -%C(red)%d%C(reset) %C(reset)%s %C(green)(%cs)%C(reset) %C(blue)%aN%C(reset)'
|
||||||
lfi = ls-files --exclude-standard -s -o -i
|
lfi = ls-files --exclude-standard -s -o -i
|
||||||
@ -42,7 +43,7 @@
|
|||||||
rmv = remote remove
|
rmv = remote remove
|
||||||
cf = !git config --file ~/.gitconfig.local
|
cf = !git config --file ~/.gitconfig.local
|
||||||
; Helpers
|
; Helpers
|
||||||
aliases = "!sh -c 'if test -n \"$1\"; then git config --get alias.$1; else git config --get-regexp \"alias.*\" | colrm 1 6 | sed \"s/[ ]/ = /\"; fi'" -
|
aliases = "!sh -c 'if test -n \"$1\"; then git config --get \"alias.$1\"; else git config --get-regexp \"alias.*\" | colrm 1 6 | sed \"s/[ ]/ = /\"; fi'" -
|
||||||
; Patch with subject prefix containing repository name and output
|
; Patch with subject prefix containing repository name and output
|
||||||
; directory has the child directories the repository and branch name.
|
; directory has the child directories the repository and branch name.
|
||||||
fp = "!sh -c 'git rev-parse --show-toplevel 2>&1 >/dev/null || return; \
|
fp = "!sh -c 'git rev-parse --show-toplevel 2>&1 >/dev/null || return; \
|
||||||
@ -63,28 +64,41 @@
|
|||||||
; whatis <commit name>
|
; whatis <commit name>
|
||||||
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
|
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
|
||||||
; See what commits have been created by the last command, eg: git pull
|
; See what commits have been created by the last command, eg: git pull
|
||||||
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
|
new = !sh -c 'git log "$1@{1}..$1@{0}" "$@"'
|
||||||
; List commits with the same the abbreviated hash.
|
; List commits with the same the abbreviated hash.
|
||||||
abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -"
|
abbr = "!sh -c 'git rev-list --all | grep \"^$1\" | while read commit; do \
|
||||||
|
git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -"
|
||||||
; Solve merge conflicts
|
; Solve merge conflicts
|
||||||
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; vim $(f)"
|
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; \
|
||||||
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add $(f)"
|
editor=\"$(git var GIT_EDITOR)\"; \
|
||||||
|
if test -z \"${editor}\"; then \
|
||||||
|
exit 1; \
|
||||||
|
else \
|
||||||
|
\"${editor}\" $(f); \
|
||||||
|
fi"
|
||||||
|
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; \
|
||||||
|
git add $(f)"
|
||||||
; List tips of branches that are not in the first arg.
|
; List tips of branches that are not in the first arg.
|
||||||
; git tips origin/master ^origin/alternate | git oneline
|
; git tips origin/master ^origin/alternate | git oneline
|
||||||
oneline ="!_() { $(test $# -eq 0 && printf '%s\n' \"xargs -L1\") git log --no-walk --decorate --oneline \"$@\"; }; _"
|
oneline ="!_() { $(test $# -eq 0 && printf '%s' \"xargs -L1\") \
|
||||||
tips = "!_() { t=$(git rev-list --no-merges --max-count=1 \"$@\"); if test -n \"$t\"; then printf '%s\n' \"$t\"; _ \"$@\" ^$t; fi; }; _"
|
git log --no-walk --decorate --oneline \"$@\"; }; _"
|
||||||
|
tips = "!_() { t=$(git rev-list --no-merges --max-count=1 \"$@\"); \
|
||||||
|
if test -n \"$t\"; then printf '%s\\n' \"$t\"; _ \"$@\" ^$t; fi; }; _"
|
||||||
; Submodules.
|
; Submodules.
|
||||||
sub-update = !sh -c 'git checkout $1 && git submodule update --recursive'
|
sub-update = !sh -c 'git checkout \"$1\" && git submodule update --recursive'
|
||||||
; Signed tags and commits
|
; Signed tags and commits
|
||||||
stag = "!sh -c 'commit_id=\"$(git rev-parse --verify \"$@\")\"; \
|
stag = "!f() { \
|
||||||
tag_name=\"signed_tag_for_$(printf '%s\n' \"$commit_id\" | cut -c 1-8)\"; \
|
commit_id=\"$(git rev-parse --verify \"$@\")\"; \
|
||||||
git tag -s \"$tag_name\" \
|
if test -z \"$commit_id\"; then exit 1; fi; \
|
||||||
-m \"Tag for commit $commit_id\" \"$commit_id\"; \
|
tag_name=\"signed_tag_for_$(printf '%s' \"$commit_id\" | cut -c 1-8)\"; \
|
||||||
printf '%s\n' \"$tag_name\"'" -
|
if git tag -s \"$tag_name\" -m \"Tag for commit $commit_id\" \"$commit_id\"; \
|
||||||
ptag = !git push $(git config branch.$(git branch --show-current).remote) $(git describe)
|
then printf '%s\\n' \"$tag_name\"; fi; \
|
||||||
vtag = !git verify-tag -v $(git describe)
|
}; f" -
|
||||||
vhci = !git verify-commit -v $(git rev-parse HEAD)
|
|
||||||
vhtag = !git verify-tag -v $(git tag --points-at=HEAD)
|
ptag = !git push "$(git config branch.$(git branch --show-current).remote)" "$(git describe)"
|
||||||
|
vtag = !git verify-tag -v "$(git describe)"
|
||||||
|
vhci = !git verify-commit -v "$(git rev-parse HEAD)"
|
||||||
|
vhtag = !git verify-tag -v "$(git tag --points-at=HEAD)"
|
||||||
[blame]
|
[blame]
|
||||||
coloring = repeatedLines
|
coloring = repeatedLines
|
||||||
[branch]
|
[branch]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user