# vim: set filetype=gitconfig :

# We configure the pull requests from Codeberg as a separate remote
# to allow easy fetching of pull requests:
[remote "pull-requests"]
	url = https://codeberg.org/guix/guix
	fetch = +refs/pull/*/head:refs/remotes/pull-requests/*
# This gitconfig snippet is convenient for those with commit access:
#[url "git@codeberg.org:"]
#	pushInsteadOf = https://codeberg.org/

[diff]
        # This does wonder to avoid fragmenting the hunks of package additions
        # that would confuse the diff and make individually staging the added
        # packages troublesome.
        algorithm = histogram

[diff "scheme"]
	xfuncname = "^(\\(define.*)$"

[diff "texinfo"]
	xfuncname = "^@node[[:space:]]+([^,]+).*$"

[format]
        forceinbodyfrom = true  # help preserve commit authorship
        thread = shallow
        useAutoBase = whenAble

[pull]
        rebase = true

[sendemail]
        to = guix-patches@gnu.org
        headerCmd = etc/teams.scm cc-members-header-cmd
        thread = no

[alias]
	# These aliases assume that the Codeberg repository is set as the origin.
	# After committing your changes run 'git pr-push <branch> <topic>'
	# to use the AGit workflow.
	# See also: https://forgejo.org/docs/latest/user/git-cli/agit-support/
	# For example: git pr-push master Update-hello-to-2.12.3
	pr-push = "!f() { \
		branch=$1; shift; topic=$1; shift; \
		git push pull-requests HEAD:refs/for/\"$branch\"/\"$topic\" -o force-push=true \"$@\"; \
		}; f \"$@\""
	pr-apply = "!f() { \
		for id in $(git cherry HEAD pull-requests/\"$1\" | cut -c2-); \
		do git cherry-pick --signoff \"$id\"; done; \
		git commit --amend --no-edit --trailer 'Merges: guix/guix#'\"$1\"; \
		}; f \"$@\""

[b4]
        attestation-check-dkim = off
        attestation-policy = off
        shazam-am-flags = --signoff --3way
        linkmask = https://yhetil.org/guix/%s
        linktrailermask = https://yhetil.org/guix/%s
        midmask = https://yhetil.org/guix/%s
