Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: do not overwrite .gitignore in output directory

Commit 3a51ff344204 ("kbuild: gitignore output directory") seemed to
bother people who version-control output directories.

Andre Przywara says:
"Unfortunately this breaks my setup, because I keep a totally separate
git repository in my build directories to track (various versions of)
.config. So .gitignore there is carefully crafted to ignore most build
artefacts, but not .config, for instance."

Link: https://lkml.org/lkml/2019/3/22/1819
Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>

+2 -1
+2 -1
Makefile
··· 499 499 ifneq ($(KBUILD_SRC),) 500 500 $(Q)ln -fsn $(srctree) source 501 501 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) 502 - $(Q){ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore 502 + $(Q)test -e .gitignore || \ 503 + { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore 503 504 endif 504 505 505 506 ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)