[user]
	name = Fabian Peter Hammerle
	email = fabian@hammerle.me
	signingkey = 8D2902FE7DF47DDEDA2802F9456B9A0399A5DA2F

[core]
	excludesfile = ~/.config/git/gitignore
	# hooksPath = ~/.config/git/hooks

[interactive]
	singleKey = true

[init]
	defaultBranch = main

[status]
	branch = true
	short = true
	showUntrackedFiles = normal

[grep]
	lineNumber = true

[diff]
	tool = vimdiff

[diff "cat"]
	textconv = cat

[diff "csv-to-yaml"]
	textconv = csv-to-yaml

[diff "db_dump"]
	textconv = db_dump

[diff "gpg-show-keys"]
	textconv = gpg --show-keys --with-subkey-fingerprint --with-keygrip --

[diff "gpg-verify"]
	textconv = gpg --verify --output=- 2>&1 --

[diff "hexdump"]
	textconv = od -t x1z --

[diff "yq"]
	textconv = yq --yaml-output --indentless-lists . --

[diff "openssl-x509-text"]
	textconv = "sh -c 'while openssl x509 -noout -text; do echo; done' <\"$1\" 2>&1"

[diff "pandas-parquet-to-json"]
	# g+r for podman container
	# https://git.hammerle.me/fphammerle/setup/commit/9c7167b9a9f7e5829d1fba5006b104ab72f6d13a
	textconv = "chmod g+r \"$1\" && env --debug -- pandas-parquet-to-json"

[diff "pgpdump"]
	textconv = pgpdump

[diff "xzcat"]
	textconv = xzcat

[diff "zcat"]
	textconv = zcat

[filter "ipynb"]
	clean = jq --indent 1 '.cells[].id? = null | (.cells[].outputs[].data[\"application/vnd.jupyter.widget-view+json\"]|objects|select(has(\"model_id\"))).model_id |= null'

[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true

[filter "meshtastic-firmware-config"]
    clean = "yq --yaml-output --indentless-lists '.channel_url = \"…\" | .config.bluetooth.fixedPin = \"…\" | .module_config.ambientLighting.blue = \"…\" | .module_config.ambientLighting.green = \"…\" | .module_config.ambientLighting.red = \"…\"' --"

[commit]
	gpgsign = true
	verbose = true

[rebase]
	instructionFormat = %G? %s (%an <%ae>, %ai)
	autostash = true

[push]
	default = current

[url "git@git.hammerle.me:"]
	pushInsteadOf = https://git.hammerle.me/

[url "git@github.com:"]
	pushInsteadOf = https://github.com/

[tag]
	forceSignAnnotated = true

[log]
	date = iso8601-strict

[gcrypt]
	participants = 8D2902FE7DF47DDEDA2802F9456B9A0399A5DA2F
	publish-participants = false

[annex]
	securehashesonly = true
	autocommit = false
	synccontent = true
	# copy instead of hard-linking when unlocking
	thin = false
	# assistant: do not auto delete unused files
	expireunused = false
	# fixes sync of repos inside encfs mounts
	ssh-options = -S~/.ssh/%r@%n:%p

[alias]
	a = add
	c = commit
	# git curl-github-api /commits/master/statuses | jq '.[].state'
	curl-github-api = "!f() { path="$1"; shift; git github-repo-names | xargs -I{} --verbose curl --header 'Accept: application/vnd.github.v3+json' 'https://api.github.com/repos/{}'\"$path\" "$@"; }; f"
	# git curl-github-ref-status dev | jq '{state, statuses, commit_url}'
	curl-github-ref-status = "!f() { ref="$1"; shift; git curl-github-api "/commits/$ref/status" "$@"; }; f"
	d = diff
	f = fetch --prune
	github-repo-names = !git github-urls | grep --only-matching --perl-regexp 'github.com/\\K.+(?=\\.git)'
	github-urls = !git remote-urls | grep ^https://github.com/
	p = push --verbose
	remote-urls = !git remote | xargs -L1 git remote get-url
	s = status
	t = for-each-ref --sort taggerdate --format '%(taggerdate:iso) %(objectname) %(tag)' refs/tags
	tree = log --graph --format=format:'%C(red)%G?%C(reset) %C(yellow)%h%C(reset)%C(blue)%d%C(reset) %C(dim green)%ar%C(reset) %C(white)%s%C(reset) %C(dim cyan)(%an, %ai)%C(reset)' --all
	x = annex