# Copyright 2025-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.15.1

EAPI=8

CRATES="
"

RUST_MIN_VER="1.89.0"

inherit cargo eapi9-pipestatus shell-completion toolchain-funcs

DESCRIPTION="Jujutsu - an experimental version control system"
HOMEPAGE="https://www.jj-vcs.dev/"
SRC_URI="
	https://github.com/jj-vcs/jj/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz
	https://github.com/gentoo-crate-dist/${PN}/releases/download/v${PV}/${P}-crates.tar.xz
	${CARGO_CRATE_URIS}
"

LICENSE="Apache-2.0"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 BSD MIT MIT-0 MPL-2.0 Unicode-3.0 Unicode-DFS-2016
	WTFPL-2 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

QA_FLAGS_IGNORED="usr/bin/${PN}"

DOCS=(
	CHANGELOG.md
	GOVERNANCE.md
	README.md
	SECURITY.md
	demos/
	docs/
)

src_test() {
	local CARGO_SKIP_TESTS=(
		test_converge_command::test_converge_description_changed_inconsistently::invoke_text_editor
		test_gpg::gpgsm_unknown_key
	)

	cargo_src_test
}

src_install() {
	cargo_src_install --path cli

	einstalldocs

	if ! tc-is-cross-compiler ; then
		PATH="${ED}/usr/bin:${PATH}" COMPLETE=zsh jj | sed -e 's/_clap_dynamic_completer_jj/_jj/' > jj-zsh.comp
		pipestatus || die
		PATH="${ED}/usr/bin:${PATH}" COMPLETE=bash jj > jj-bash.comp || die
		newzshcomp jj-zsh.comp _jj
		newbashcomp jj-bash.comp jj
	fi
}
