package git {
	description = "distributed version control system";
	website = "https://www.git-scm.com";
	anitya = 5350;

	version# = "2.55.0";
	source = remoteTar {
		url = "https://www.kernel.org/pub/software/scm/git/"+
			"git-"+version+".tar.gz";
		checksum = "lOer6jb8vZQk6Nd1rLZIgsYys8whLvjJq8XbmCdTATcPFAYuQcK1Rgj1Jj6a00W8";
		compress = gzip;
	};

	early = `
# test suite assumes apache
rm -f /system/bin/httpd
`;

	// uses source tree as scratch space
	enterSource = true;
	env = [ "NO_RUST=YesPlease" ];

	bin = [ "perl" ];
	populateUsrBin = true;
	exec = make {
		inPlace = true;
		generate = "make configure";

		preMake = `
function disable_test {
	local test=$1 pattern=${2:-''}
	if [ $# -eq 1 ]; then
		rm "t/${test}.sh"
	else
		sed -i "t/${test}.sh" \
			-e "/^\s*test_expect_.*$pattern/,/^\s*' *\$/{s/^/: #/}"
	fi
}

disable_test t1800-hook
disable_test t5319-multi-pack-index
disable_test t1305-config-include
disable_test t3900-i18n-commit
disable_test t3507-cherry-pick-conflict
disable_test t4201-shortlog
disable_test t5303-pack-corruption-resilience
disable_test t4301-merge-tree-write-tree
disable_test t8005-blame-i18n
disable_test t9350-fast-export
disable_test t9300-fast-import
disable_test t0211-trace2-perf
disable_test t1517-outside-repo
disable_test t2200-add-update
disable_test t0027-auto-crlf
disable_test t7513-interpret-trailers
disable_test t7703-repack-geometric
disable_test t3705-add-sparse-checkout
disable_test t7002-mv-sparse-checkout
disable_test t1451-fsck-buffer
disable_test t4104-apply-boundary
disable_test t4200-rerere
disable_test t5515-fetch-merge-logic
`;

		check = [
			"-C t",
			`GIT_PROVE_OPTS="--jobs 32 --failures"`,
			"prove",
		];

		install = `make \
	` + jobsFlagE + ` \
	DESTDIR=/work \
	NO_INSTALL_HARDLINKS=1 \
	install`;
	};

	inputs = [
		// test suite hangs on mksh
		bash,

		diffutils,
		autoconf,
		gettext,

		zlib,
		curl,
		libexpat,
		kernel-headers,
	];

	runtime = [
		zlib,
		curl,
		libexpat,
	];
}
