Compare commits
12 Commits
6db1a710c6
...
7c184ed11e
| Author | SHA1 | Date | |
|---|---|---|---|
|
7c184ed11e
|
|||
|
8e8ef29b37
|
|||
|
d8859bc709
|
|||
|
65d99c40e8
|
|||
|
d28ef61694
|
|||
|
d5a95f9ce5
|
|||
|
723899d70f
|
|||
|
126ccb0c7a
|
|||
|
dadf344f2b
|
|||
|
f17cde7943
|
|||
|
a89ad407ba
|
|||
|
a26a899213
|
@@ -52,6 +52,38 @@
|
||||
sort = -committerdate
|
||||
[clone]
|
||||
filterSubmodules = yes
|
||||
[color "diff"]
|
||||
# Make all bold colors also bright. See diff_colors in git's diff.c
|
||||
oldMoved = bold brightmagenta
|
||||
oldMovedAlternative = bold brightblue
|
||||
newMoved = bold brightcyan
|
||||
newMovedAlternative = bold brightyellow
|
||||
oldBold = bold brightred
|
||||
newBold = bold brightgreen
|
||||
[color "decorate"]
|
||||
# Make all bold colors also bright. See decoration_colors in git's
|
||||
# log-tree.c
|
||||
branch = bold brightgreen
|
||||
remoteBranch = bold brightred
|
||||
tag = bold brightyellow
|
||||
stash = bold brightmagenta
|
||||
HEAD = bold brightcyan
|
||||
grafted = bold brightblue
|
||||
[color "grep"]
|
||||
# Make all bold colors also bright. See GREP_OPT_INIT in git's grep.h
|
||||
matchContext = bold brightred
|
||||
matchSelected = bold brightred
|
||||
[color "interactive"]
|
||||
# Make all bold colors also bright. See init_add_i_state in git's
|
||||
# add-interactive.c
|
||||
help = bold brightred
|
||||
prompt = bold brightblue
|
||||
error = bold brightred
|
||||
[color "remote"]
|
||||
# Make all bold colors also bright. See keywords in git's sideband.c
|
||||
warning = bold brightyellow
|
||||
success = bold brightgreen
|
||||
error = bold brightred
|
||||
[color "status"]
|
||||
added = 076
|
||||
untracked = 014
|
||||
@@ -69,7 +101,7 @@
|
||||
abbrev = 12
|
||||
#pager = delta
|
||||
pager = diff-so-fancy | less --tabs=8 --RAW-CONTROL-CHARS
|
||||
whitespace = trailing-spaces,space-before-tab,indent-with-non-tab
|
||||
whitespace = trailing-spaces,space-before-tab,indent-with-non-tab,tabwidth=8
|
||||
[delta]
|
||||
navigate = true
|
||||
commit-decoration-style = bold yellow box
|
||||
@@ -102,6 +134,12 @@
|
||||
singleKey = true
|
||||
[log]
|
||||
follow = true
|
||||
# Make all colors bold and additionally use bright versions of
|
||||
# previously bold-only colors. See column_colors_ansi in git's color.c
|
||||
# used by graph.c
|
||||
graphColors = bold red,bold green,bold yellow,bold blue,bold magenta,bold cyan,bold brightred,bold brightgreen,bold brightyellow,bold brightblue,bold brightmagenta,bold brightcyan
|
||||
# Show all refs as decoration (e.g. also notes)
|
||||
initialDecorationSet = all
|
||||
[merge]
|
||||
conflictstyle = diff3
|
||||
log = true
|
||||
@@ -118,7 +156,7 @@
|
||||
[rerere]
|
||||
enabled = false
|
||||
[status]
|
||||
submodulesummary = true
|
||||
submoduleSummary = true
|
||||
[submodule]
|
||||
fetchJobs = 0
|
||||
[trailer]
|
||||
@@ -127,5 +165,6 @@
|
||||
email = julian@druck.dev
|
||||
name = Julian Prein
|
||||
signingkey = C0A44F69F2E29F6586C86B96CA6B3A516FAC2555
|
||||
|
||||
[include]
|
||||
path = user.config
|
||||
|
||||
@@ -31,11 +31,13 @@
|
||||
|
||||
emulate -L zsh -o err_return -o no_unset
|
||||
|
||||
local REPO_NAME WORKTREE_PATH
|
||||
local git_dir cwd_offset REPO_NAME WORKTREE_PATH
|
||||
# Use the folder name of the main working tree to make calls from another
|
||||
# temporary working tree possible
|
||||
REPO_NAME="${${${$(git rev-parse --git-dir):A}%%/.git*}:t}"
|
||||
WORKTREE_PATH="$(mktemp -d -p "" "worktree.XXX.$REPO_NAME.${1//\//_}")"
|
||||
git_dir="${$(git rev-parse --git-dir):A}"
|
||||
[[ $git_dir == */.git/modules/* ]] || git_dir="${git_dir%%/.git*}"
|
||||
REPO_NAME="${git_dir:t}"
|
||||
WORKTREE_PATH="$(mktemp -d -p "" "wtree.$REPO_NAME.${1//\//_}.XXX")"
|
||||
|
||||
local errc ret=0
|
||||
git worktree add "$WORKTREE_PATH" "$@" || ret=$?
|
||||
@@ -47,11 +49,27 @@ fi
|
||||
|
||||
trap '
|
||||
errc=$?
|
||||
<&2 printf "Exiting abnormally. Check and possibly remove '$WORKTREE_PATH' manually.\n"
|
||||
<&2 printf "Exiting abnormally. Check and possibly remove \"%s\" manually.\n" "'$WORKTREE_PATH'"
|
||||
return $errc
|
||||
' INT QUIT TERM EXIT
|
||||
|
||||
cwd_offset="${${PWD#$(git rev-parse --show-toplevel)}#/}"
|
||||
pushd -q "$WORKTREE_PATH"
|
||||
until [[ -d $cwd_offset || -z $cwd_offset ]]; do
|
||||
cwd_offset="${cwd_offset:h}"
|
||||
done
|
||||
[[ -z $cwd_offset ]] || cd "$cwd_offset"
|
||||
|
||||
# Discard some environment variables that were set by git when calling this
|
||||
# script through an alias.
|
||||
#
|
||||
# Is set for submodules and will confuse git in the subshell
|
||||
unset GIT_DIR
|
||||
# Not sure if this can bring any issues, but better be safe
|
||||
unset GIT_PREFIX
|
||||
# TODO: Do we want to unset this too? Could have been set on purpose by the user
|
||||
# and not git. Maybe only for the subshell via `env`?
|
||||
#unset GIT_EXEC_PATH
|
||||
|
||||
"$SHELL" && errc=$? || errc=$?
|
||||
(( !errc )) || echo "shell exited with $errc"
|
||||
|
||||
Reference in New Issue
Block a user