In the test suite, in the test-wget2-1.sh test, I see a strange behaviour:
After removing /GNUmakefile, /maint.mk, lib from the initial .gitignore file,
gnulib-tool reflects the addition of GNUmakefile and maint.mk in the
.gitignore file, but does not do so for the added files in lib/. Which makes
no sense. Since the --vc-files option is enabled by default, all of them
should be added to the .gitignore file, or new .gitignore files should be
created in subdirectories.

This patch fixes it.


2024-03-21  Bruno Haible  <br...@clisp.org>

        gnulib-tool: Make the .gitignore files handling more consistent.
        * gnulib-tool.sh (func_done_dir): Ignore the presence or absence of a
        .git directory if there is a .gitignore file in the same place.
        * pygnulib/GLImport.py (GLImport._done_dir_): Likewise.

diff --git a/gnulib-tool.sh b/gnulib-tool.sh
index 2081ed049e..f1a36ec023 100755
--- a/gnulib-tool.sh
+++ b/gnulib-tool.sh
@@ -6290,7 +6290,7 @@ s,//*$,/,'
         if test -d "$destdir/CVS" || test -d "$destdir/${dir}CVS" || test -f 
"$destdir/${dir}.cvsignore"; then
           func_update_ignorelist .cvsignore
         fi
-        if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
+        if test -d "$destdir/.git" || test -f "$destdir/.gitignore" || test -f 
"$destdir/${dir}.gitignore"; then
           func_update_ignorelist .gitignore
         fi
       }
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 4c7b62a8df..66b63ef08e 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -781,6 +781,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
             self._update_ignorelist_(directory, '.cvsignore',
                                      dirs_added, dirs_removed)
         if (isdir(joinpath(destdir, '.git'))
+                or isfile(joinpath(destdir, '.gitignore'))
                 or isfile(joinpath(destdir, directory, '.gitignore'))):
             self._update_ignorelist_(directory, '.gitignore',
                                      dirs_added, dirs_removed)




Reply via email to