################################################################################
## Includes

## GitHub
[url "git@github.com"]
	insteadOf = github
[includeIf "gitdir:~/.config/"]
	path = config.defaults
[includeIf "gitdir:~/.local/bin/"]
	path = config.defaults
[includeIf "gitdir:~/Code/github.com/"]
	path = config.defaults
[includeIf "gitdir:~/Code/Test/"]
	path = config.defaults
[includeIf "gitdir:~/Documents/Cabinet/"]
	path = config.defaults
[includeIf "gitdir:~/Documents/Magic/decks/"]
	path = config.defaults

## GitLab
[url "git@gitlab.com"]
	insteadOf = gitlab
[includeIf "gitdir:~/Code/gitlab.com/"]
	path = config.defaults

## Codeberg
[url "git@codeberg.org"]
	insteadOf = codeberg
[includeIf "gitdir:~/Code/codeberg.org/"]
	path = config.defaults

## GNOME
[url "git@gitlab.gnome.org"]
	insteadOf = gnome
[includeIf "gitdir:~/Code/gitlab.gnome.org/"]
	path = config.defaults

## Work
[include]
	# This should include `includeIf`:s and `url`:s similar to above
	path = config.work

################################################################################
## Sync

[sync "~/.config"]
	name = Config
	url  = github:mattiasb/.config.git

[sync "~/.local/bin"]
	name = Bin
	url  = github:mattiasb/.local-bin.git

[sync "~/Code/Test"]
	name = Test
	url  = github:mattiasb/Code-Test.git

[sync "~/Code/github.com/mattiasb/MachineSetup"]
	name = Machine Setup
	url  = github:mattiasb/MachineSetup.git

[sync "~/Code/github.com/mattiasb/emacs-2.0"]
	name = Emacs 2.0
	url  = github:mattiasb/emacs-2.0.git

[sync "~/Documents/Cabinet"]
	name = Cabinet
	url  = github:mattiasb/Cabinet

[sync "~/Documents/Magic/decks"]
	name = MTG Decks
	url  = github:mattiasb/mtg-decks.git

################################################################################

[push]
	default = simple
	followTags = true
[color]
	diff = always

[core]
	pager = delta --features "$(gnome-color-scheme)"
	excludesfile = ~/.config/git/ignore
	editor = emacsclient -c -s main
[alias]
	authors        = "!f() { git log --oneline --pretty='format:%aN <%aE>' ${1:+${1}..} | sort | uniq; }; f"
	slog             = log --oneline
	# Execute shell scripts in top directory.
	exec             = ! exec

	difft            = -c diff.external=difft diff

	history-grep     = log -p -G

	projects         = "!f() { cd; git each $@ :: Code/github.com/mattiasb/*; }; f"

	remotes          = "!f() { git remote -v show -n | column -t; }; f"

	sloc             = "!f() { git ls-files -z | xargs -0 cat | wc -l; }; f"
	sloc-report      = "!f() { cloc $(git ls-files); }; f"

	patch-diff       = "!f() { diff -u <(git --no-pager show \"${1}\" | tail -n +2) <(git --no-pager show \"${2}\" | tail -n +2); }; f"
[diff]
	tool = meld
	mnemonicPrefix = true
[rebase]
	autoStash = true
	updateRefs = true
[branch]
	autosetuprebase = always
[status]
	showUntrackedFiles = all
[magit]
	hideCampaign = true
[merge]
	tool = meld
[merge "ansible-vault"]
	name = Ansible vault merge driver
	driver = ansible-vault-merge %O %A %B %L %P
	recursive = binary
[diff "ansible-vault"]
	textconv = ansible-vault view
	cachetextconv = false

[github]
	user = mattiasb
[gitlab]
	host = http://gitlab.com/api/v4
	user = mattiasb
[gitlab "gitlab.gnome.org/api/v4"]
	user = mattiasb
[pull]
	rebase = true
[interactive]
	diffFilter = delta --color-only --features "$(gnome-color-scheme)"
[delta]
	navigate = t
[delta "light"]
	syntax-theme = GitHub
[delta "dark"]
	syntax-theme = Dracula
	light = false

[commit]
	status = false
[init]
	defaultBranch = main
[submodule]
	recurse = true
