Skip to content

Commit 156e7cb

Browse files
committed
kbuild: do not overwrite .gitignore in output directory
Commit 3a51ff3 ("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>
1 parent 221cc2d commit 156e7cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ outputmakefile:
499499
ifneq ($(KBUILD_SRC),)
500500
$(Q)ln -fsn $(srctree) source
501501
$(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
503504
endif
504505

505506
ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)

0 commit comments

Comments
 (0)