bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bootstrap: anchor .gitignore entries.


From: Joel E. Denny
Subject: [PATCH] bootstrap: anchor .gitignore entries.
Date: Sat, 16 Oct 2010 17:14:22 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi,

Quite some time ago, we discussed the fact that a .gitignore entry without 
a leading `/' applies recursively to subdirectories, and Bruno then fixed 
gnulib-tool to prepend a `/' to .gitignore entries that it constructs:

  http://lists.gnu.org/archive/html/bug-gnulib/2008-08/msg00002.html

The patch below fixes bootstrap to do the same.  Ok to commit?

>From 8b9b4bbba5041e107a8dea35e78d28dd3cc979f7 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sat, 16 Oct 2010 16:54:23 -0400
Subject: [PATCH] bootstrap: anchor .gitignore entries.

* build-aux/bootstrap (insert_sorted_if_absent): Replace all uses
with...
(insert_vc_ignore): ... this new function, which prepends `/' to
all .gitignore entries before passing them to
insert_sorted_if_absent.
---
 ChangeLog           |    9 +++++++++
 build-aux/bootstrap |   25 ++++++++++++++++++++-----
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index de256ba..1e9e778 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-16  Joel E. Denny  <address@hidden>
+
+       bootstrap: anchor .gitignore entries.
+       * build-aux/bootstrap (insert_sorted_if_absent): Replace all uses
+       with...
+       (insert_vc_ignore): ... this new function, which prepends `/' to
+       all .gitignore entries before passing them to
+       insert_sorted_if_absent.
+
 2010-10-16  Bruno Haible  <address@hidden>
 
        nextafter: Fix configure check.
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 2b3f24b..8c8d777 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -261,6 +261,21 @@ insert_sorted_if_absent() {
     || exit 1
 }
 
+# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
+# insert_sorted_if_absent.
+insert_vc_ignore() {
+  vc_ignore_file="$1"
+  pattern="$2"
+  case $vc_ignore_file in
+  *.gitignore)
+    # A .gitignore entry that does not start with `/' applies
+    # recursively to subdirectories, so prepend `/' to every
+    # .gitignore entry.
+    pattern=`echo "$pattern" | sed s,^,/,`;;
+  esac
+  insert_sorted_if_absent "$vc_ignore_file" "$pattern"
+}
+
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
 found_aux_dir=no
 grep '^[        ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -279,7 +294,7 @@ if test ! -d $build_aux; then
   mkdir $build_aux
   for dot_ig in x $vc_ignore; do
     test $dot_ig = x && continue
-    insert_sorted_if_absent $dot_ig $build_aux
+    insert_vc_ignore $dot_ig $build_aux
   done
 fi
 
@@ -565,7 +580,7 @@ symlink_to_dir()
       for dot_ig in x $vc_ignore; do
         test $dot_ig = x && continue
         ig=$parent/$dot_ig
-        insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
+        insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
       done
     fi
 
@@ -725,7 +740,7 @@ slurp() {
       test $dot_ig = x && continue
       ig=$dir/$dot_ig
       if test -n "$copied"; then
-        insert_sorted_if_absent $ig "$copied"
+        insert_vc_ignore $ig "$copied"
         # If an ignored file name ends with .in.h, then also add
         # the name with just ".h".  Many gnulib headers are generated,
         # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
@@ -738,12 +753,12 @@ slurp() {
             s/\.gperf$/.h/
           '
         `
-        insert_sorted_if_absent $ig "$f"
+        insert_vc_ignore $ig "$f"
 
         # For files like sys_stat.in.h and sys_time.in.h, record as
         # ignorable the directory we might eventually create: sys/.
         f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
-        insert_sorted_if_absent $ig "$f"
+        insert_vc_ignore $ig "$f"
       fi
     done
   done
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]