Compare commits
1 Commits
main
...
1f90abe997
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f90abe997 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
credentials
|
|
||||||
local
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#compdef git-ls-ignored
|
|
||||||
#description List files which exist and are ignored by this repository.
|
|
||||||
|
|
||||||
# Offer the paths the script would actually list, so the candidates match its
|
|
||||||
# rules rather than the --exclude-standard set used by zsh's own
|
|
||||||
# __git_ignored_other_files. _multi_parts descends one component at a time, so
|
|
||||||
# a directory holding ignored files completes as a way to narrow the listing.
|
|
||||||
__git-ls-ignored_files() {
|
|
||||||
local common_dir expl
|
|
||||||
local -a excludes files
|
|
||||||
|
|
||||||
if (( $+opt_args[-g] + $+opt_args[--global] )); then
|
|
||||||
excludes=(--exclude-standard)
|
|
||||||
else
|
|
||||||
common_dir=$(_call_program common-dir git rev-parse --git-common-dir 2>/dev/null)
|
|
||||||
[[ -n $common_dir ]] || return 1
|
|
||||||
[[ $common_dir == /* ]] || common_dir=$PWD/$common_dir
|
|
||||||
excludes=(--exclude-per-directory=.gitignore)
|
|
||||||
[[ -f $common_dir/info/exclude ]] &&
|
|
||||||
excludes+=(--exclude-from=$common_dir/info/exclude)
|
|
||||||
fi
|
|
||||||
|
|
||||||
files=(${(0)"$(_call_program ignored-files git ls-files -z --others --ignored \
|
|
||||||
${(q)excludes} 2>/dev/null)"})
|
|
||||||
(( $#files )) || return 1
|
|
||||||
|
|
||||||
_wanted ignored-files expl 'ignored file' _multi_parts -f - / files
|
|
||||||
}
|
|
||||||
|
|
||||||
_git-ls-ignored() {
|
|
||||||
_arguments -s -S \
|
|
||||||
'(-d --directory)'{-d,--directory}'[list an ignored directory by name instead of its contents]' \
|
|
||||||
'(-g --global)'{-g,--global}'[also apply the global core.excludesfile]' \
|
|
||||||
'(-z)-z[terminate entries with NUL instead of newline]' \
|
|
||||||
'(- *)'{-h,--help}'[show usage information]' \
|
|
||||||
'*:pathspec:__git-ls-ignored_files'
|
|
||||||
}
|
|
||||||
|
|
||||||
_git-ls-ignored "$@"
|
|
||||||
|
|
||||||
# vim: ft=zsh
|
|
||||||
25
config
25
config
@@ -12,7 +12,7 @@
|
|||||||
awk \"{print \\$1}\" | \
|
awk \"{print \\$1}\" | \
|
||||||
sed -e ':a' -e 'N' -e '$!ba' -e 's/\\n/../g') | \
|
sed -e ':a' -e 'N' -e '$!ba' -e 's/\\n/../g') | \
|
||||||
git apply - 2> /dev/null || \
|
git apply - 2> /dev/null || \
|
||||||
echo "\\\\033[31merror:\\\\033[39m last commit was not amended"
|
echo \"\\e[31merror:\\e[39m last commit was not amended\"
|
||||||
fixup = commit --fixup
|
fixup = commit --fixup
|
||||||
squash = commit --squash
|
squash = commit --squash
|
||||||
prepare = rebase -i --fork-point
|
prepare = rebase -i --fork-point
|
||||||
@@ -21,18 +21,12 @@
|
|||||||
local = !git branch -vv | \
|
local = !git branch -vv | \
|
||||||
cut -c 3- | \
|
cut -c 3- | \
|
||||||
awk '$3 !~/\\[/ { print $1 }'
|
awk '$3 !~/\\[/ { print $1 }'
|
||||||
recent = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | \
|
|
||||||
grep 'checkout:' | \
|
|
||||||
grep -oE '[^ ]+ ~ .*' | \
|
|
||||||
awk -F~ '!seen[$1]++' | \
|
|
||||||
head -n 10 | \
|
|
||||||
awk -F ' ~ HEAD@{' '{printf(\" %s \\033[33m%s\\033[0m\\n\", $1, substr($2, 1, length($2)-1))}'
|
|
||||||
create = checkout -b
|
create = checkout -b
|
||||||
delete = branch -D
|
delete = branch -D
|
||||||
refname = rev-parse --abbrev-ref HEAD
|
refname = rev-parse --abbrev-ref HEAD
|
||||||
|
|
||||||
publish = !git push -u `git config --get publish.remote || echo origin` `git refname`
|
publish = !git push -u origin `git refname`
|
||||||
unpublish = !git push -u `git config --get publish.remote || echo origin` :`git refname`
|
unpublish = !git push -u origin :`git refname`
|
||||||
force = push --force-with-lease
|
force = push --force-with-lease
|
||||||
|
|
||||||
changes = !sh -c 'git log --oneline $1..' --
|
changes = !sh -c 'git log --oneline $1..' --
|
||||||
@@ -44,17 +38,12 @@
|
|||||||
|
|
||||||
save = commit -m "temp!"
|
save = commit -m "temp!"
|
||||||
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
|
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
|
||||||
git reset --mixed HEAD~ || echo \"\\033[31merror:\\033[39m commit subject is not: temp!\"'
|
git reset --mixed HEAD~ || echo \"\\e[31merror:\\e[39m commit subject is not: temp!\"'
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
|
editor = vim
|
||||||
excludesfile = ~/.config/git/excludes
|
excludesfile = ~/.config/git/excludes
|
||||||
|
|
||||||
[init]
|
|
||||||
defaultBranch = main
|
|
||||||
|
|
||||||
[branch]
|
|
||||||
sort = -committerdate
|
|
||||||
|
|
||||||
[fetch]
|
[fetch]
|
||||||
prune = true
|
prune = true
|
||||||
|
|
||||||
@@ -91,7 +80,3 @@
|
|||||||
[include]
|
[include]
|
||||||
path = ~/.config/private/gitconfig
|
path = ~/.config/private/gitconfig
|
||||||
path = ~/.config/work/gitconfig
|
path = ~/.config/work/gitconfig
|
||||||
path = ~/.config/git/local
|
|
||||||
|
|
||||||
[advice]
|
|
||||||
skippedCherryPicks = false
|
|
||||||
|
|||||||
4
excludes
4
excludes
@@ -1,9 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.cache
|
|
||||||
.config
|
|
||||||
.enter
|
.enter
|
||||||
.exit
|
.exit
|
||||||
.local
|
.local
|
||||||
.share
|
|
||||||
.vim
|
.vim
|
||||||
compile_commands.json
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Find local branches that have been squash-merged into a target branch.
|
|
||||||
# Usage: git-find-merged [target-branch]
|
|
||||||
# Default target branch: main
|
|
||||||
|
|
||||||
target="${1:-main}"
|
|
||||||
|
|
||||||
git for-each-ref refs/heads/ --format='%(refname:short)' | while read branch; do
|
|
||||||
[[ "$branch" == "$target" ]] && continue
|
|
||||||
merge_base=$(git merge-base "$target" "$branch" 2>/dev/null) || continue
|
|
||||||
tree=$(git rev-parse "$branch^{tree}" 2>/dev/null) || continue
|
|
||||||
squash_commit=$(git commit-tree "$tree" -p "$merge_base" -m "test" 2>/dev/null) || continue
|
|
||||||
cherry_result=$(git cherry "$target" "$squash_commit" 2>/dev/null)
|
|
||||||
if [[ "$cherry_result" == "-"* ]]; then
|
|
||||||
echo "$branch"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# List files which exist in the working tree and are ignored by this
|
|
||||||
# repository's own rules: any .gitignore file, plus $GIT_DIR/info/exclude.
|
|
||||||
#
|
|
||||||
# Unlike `git status --ignored`, the global core.excludesfile is not consulted
|
|
||||||
# unless --global is given, so the output only contains paths this repository
|
|
||||||
# chose to ignore.
|
|
||||||
#
|
|
||||||
# Works inside a linked worktree, where .git is a file and info/exclude lives in
|
|
||||||
# the common git directory rather than next to the worktree.
|
|
||||||
#
|
|
||||||
# Usage: git-ls-ignored [<options>] [--] [<pathspec>...]
|
|
||||||
#
|
|
||||||
# -d, --directory list an ignored directory by name instead of its contents
|
|
||||||
# -g, --global also apply the global core.excludesfile
|
|
||||||
# -z terminate entries with NUL instead of newline
|
|
||||||
# -h, --help show this message
|
|
||||||
#
|
|
||||||
# Paths are relative to the top of the working tree. Without a <pathspec> the
|
|
||||||
# whole working tree is listed, not just the current directory.
|
|
||||||
|
|
||||||
# Print the comment block above, minus the shebang, as the help text.
|
|
||||||
usage() {
|
|
||||||
awk 'NR == 1 { next } /^#/ { sub(/^# ?/, ""); print; next } { exit }' "$0"
|
|
||||||
}
|
|
||||||
|
|
||||||
global=false
|
|
||||||
options=()
|
|
||||||
paths=()
|
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
|
||||||
case "$1" in
|
|
||||||
-d | --directory) options+=(--directory) ;;
|
|
||||||
-g | --global) global=true ;;
|
|
||||||
-z) options+=(-z) ;;
|
|
||||||
-h | --help)
|
|
||||||
usage
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
--)
|
|
||||||
shift
|
|
||||||
paths+=("$@")
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
echo "error: unknown option: $1" >&2
|
|
||||||
usage >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
*) paths+=("$1") ;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
# In a worktree .git is a file pointing at .git/worktrees/<name>, which has no
|
|
||||||
# info/exclude of its own; Git reads the one in the common directory, so that is
|
|
||||||
# the file to point --exclude-from at. The common directory is reported relative
|
|
||||||
# to the current directory unless it happens to be absolute.
|
|
||||||
common_dir=$(git rev-parse --git-common-dir) || exit $?
|
|
||||||
case "$common_dir" in
|
|
||||||
/*) ;;
|
|
||||||
*) common_dir="$PWD/$common_dir" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if $global; then
|
|
||||||
# .gitignore, info/exclude and core.excludesfile.
|
|
||||||
excludes=(--exclude-standard)
|
|
||||||
else
|
|
||||||
excludes=(--exclude-per-directory=.gitignore)
|
|
||||||
# --exclude-from is fatal on a missing file, and info/exclude is optional.
|
|
||||||
if [ -f "$common_dir/info/exclude" ]; then
|
|
||||||
excludes+=("--exclude-from=$common_dir/info/exclude")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
git ls-files --others --ignored --full-name "${excludes[@]}" "${options[@]}" \
|
|
||||||
-- "${paths[@]:-:/}"
|
|
||||||
23
git-sync
23
git-sync
@@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
autoload -U colors && colors
|
|
||||||
|
|
||||||
git_sync=${GIT_SYNC:-~/.config/git-sync}
|
|
||||||
|
|
||||||
if [ ! -f "$git_sync" ]; then
|
|
||||||
echo "$fg[yellow]warning:${reset_color} sync list does not exist: $git_sync"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
local repos=($(cat $git_sync))
|
|
||||||
if [ ${#repos[@]} = 0 ]; then
|
|
||||||
echo "$fg[yellow]warning:${reset_color} sync list is empty: $git_sync"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
for repo in $repos; do
|
|
||||||
print -P "$fg[cyan]synchronizing: $repo${reset_color}"
|
|
||||||
repo="${repo/#\~/$HOME}"
|
|
||||||
git -C "$repo" fetch
|
|
||||||
done
|
|
||||||
34
install.sh
34
install.sh
@@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
symlink() {
|
|
||||||
local source=$1
|
|
||||||
local dest=$2
|
|
||||||
mkdir -p $(dirname $dest)
|
|
||||||
if [ -L $dest ]; then
|
|
||||||
local target=`readlink $dest`
|
|
||||||
if [ "$target" != "$source" ]; then
|
|
||||||
rm $dest
|
|
||||||
ln -s $source $dest
|
|
||||||
echo changed replace incorrect symlink $dest
|
|
||||||
fi
|
|
||||||
elif [ -f $dest ]; then
|
|
||||||
error symlink failed $dest exists but is a regular file
|
|
||||||
else
|
|
||||||
ln -s $source $dest
|
|
||||||
echo changed created symlink $dest
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
symlink ~/.config/git/_git-changes \
|
|
||||||
~/.local/share/zsh/site-functions/_git-changes
|
|
||||||
|
|
||||||
symlink ~/.config/git/git-sync \
|
|
||||||
~/.local/bin/git-sync
|
|
||||||
|
|
||||||
symlink ~/.config/git/git-find-merged \
|
|
||||||
~/.local/bin/git-find-merged
|
|
||||||
|
|
||||||
symlink ~/.config/git/git-ls-ignored \
|
|
||||||
~/.local/bin/git-ls-ignored
|
|
||||||
symlink ~/.config/git/_git-ls-ignored \
|
|
||||||
~/.local/share/zsh/site-functions/_git-ls-ignored
|
|
||||||
27
main.yaml
Normal file
27
main.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Clone git private config repository
|
||||||
|
git:
|
||||||
|
repo: git@code.infektor.net:benie/config.git
|
||||||
|
dest: ~/.config/private
|
||||||
|
- name: Install git homebrew packages
|
||||||
|
when: ansible_os_family == "Darwin"
|
||||||
|
homebrew:
|
||||||
|
name: gpg
|
||||||
|
state: latest
|
||||||
|
- name: Intall git pip packages
|
||||||
|
pip:
|
||||||
|
name: git+ssh://git@github.com/kbenzie/git-issue.git
|
||||||
|
extra_args: --user
|
||||||
|
state: latest
|
||||||
|
- name: Create git symbolic links
|
||||||
|
file:
|
||||||
|
state: link
|
||||||
|
src: '{{item.src}}'
|
||||||
|
dest: '{{item.dest}}'
|
||||||
|
with_items:
|
||||||
|
- src: ~/.config/git/config
|
||||||
|
dest: ~/.gitconfig
|
||||||
|
- src: ~/.config/git/_git-changes
|
||||||
|
dest: ~/.local/share/zsh/site-functions/_git-changes
|
||||||
11
tasks.yaml
11
tasks.yaml
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
- name: git create symbolic links
|
|
||||||
file:
|
|
||||||
state: link
|
|
||||||
src: '{{item.src}}'
|
|
||||||
dest: '{{item.dest}}'
|
|
||||||
with_items:
|
|
||||||
- src: ~/.config/git/_git-changes
|
|
||||||
dest: ~/.local/share/zsh/site-functions/_git-changes
|
|
||||||
- src: ~/.config/git/git-sync
|
|
||||||
dest: ~/.local/bin/git-sync
|
|
||||||
Reference in New Issue
Block a user