162306a36Sopenharmony_ci#!/bin/sh
262306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciset -e
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci# Detect files that are tracked but ignored by git. This is checked only when
762306a36Sopenharmony_ci# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is
862306a36Sopenharmony_ci# tracked by git.
962306a36Sopenharmony_cicheck_tracked_ignored_files () {
1062306a36Sopenharmony_ci	case "${KBUILD_EXTRA_WARN}" in
1162306a36Sopenharmony_ci	*1*) ;;
1262306a36Sopenharmony_ci	*) return;;
1362306a36Sopenharmony_ci	esac
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci	git -C ${srctree:-.} ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null |
1662306a36Sopenharmony_ci		sed 's/$/: warning: ignored by one of the .gitignore files/' >&2
1762306a36Sopenharmony_ci}
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cicheck_tracked_ignored_files
20