bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Add .gitignore everywhere based on .cvsignore


From: Joel E. Denny
Subject: Re: [PATCH] Add .gitignore everywhere based on .cvsignore
Date: Wed, 16 Jul 2008 02:15:52 -0400 (EDT)

On Tue, 15 Jul 2008, Eric Blake wrote:

> > > > +/*.patch *.log log patches applied

> Nor I, so you can probably get by with an alternative patch that just deletes 
> this line altogether, since nothing directly in bison's build process creates 
> files by these names.

I pushed this patch to fix a number of ignore problems.

>From 9aacab9ae9a16465284768f4014dc08b26819180 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Wed, 16 Jul 2008 02:05:14 -0400
Subject: [PATCH] Fix some .gitignore and .cvsignore problems.

* 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.
* bootstrap.conf (vc_ignore): Set to '.cvsignore .gitignore' so that
.cvsignore files are maintained even though Bison developers run
bootstrap while using Git.
* .cvsignore (*.patch *.log log patches applied): Remove, apparently
unneeded by Bison.
(gnulib): Add.
* .gitignore (/*.patch *.log log patches applied): Remove, broken and
unneeded.  Reported by Eric Blake.
* lib/.gitignore (/*~): Add.
* po/.cvsignore, runtime-po/.cvsignore: Sync with .gitignore.
* examples/calc++/.gitignore (/calc++.exe): Add.  Reported by Eric
Blake.
* src/.gitignore (/bison.exe): Add.  Reported by Eric Blake.
---
 .cvsignore                 |    2 +-
 .gitignore                 |    1 -
 ChangeLog                  |   20 ++++++++++++++++++++
 bootstrap                  |   27 +++++++++++++++++++++------
 bootstrap.conf             |    4 ++++
 examples/calc++/.gitignore |    1 +
 lib/.gitignore             |    1 +
 po/.cvsignore              |    2 ++
 runtime-po/.cvsignore      |    2 ++
 src/.gitignore             |    1 +
 10 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/.cvsignore b/.cvsignore
index 006f8fe..d89800e 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,6 +1,5 @@
 *.cache
 *.flc
-*.patch *.log log patches applied
 *.prj
 .version
 ABOUT-NLS
@@ -21,6 +20,7 @@ config.status
 configure
 configure.lineno
 conftest*
+gnulib
 javacomp.sh
 javaexec.sh
 patches
diff --git a/.gitignore b/.gitignore
index dcc1614..440a930 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
 /*.cache
 /*.flc
-/*.patch *.log log patches applied
 /*.prj
 /.version
 /ABOUT-NLS
diff --git a/ChangeLog b/ChangeLog
index 6a019e3..8ac70e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2008-07-15  Joel E. Denny  <address@hidden>
 
+       Fix some .gitignore and .cvsignore problems.
+       * 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.
+       * bootstrap.conf (vc_ignore): Set to '.cvsignore .gitignore' so that
+       .cvsignore files are maintained even though Bison developers run
+       bootstrap while using Git.
+       * .cvsignore (*.patch *.log log patches applied): Remove, apparently
+       unneeded by Bison.
+       (gnulib): Add.
+       * .gitignore (/*.patch *.log log patches applied): Remove, broken and
+       unneeded.  Reported by Eric Blake.
+       * lib/.gitignore (/*~): Add.
+       * po/.cvsignore, runtime-po/.cvsignore: Sync with .gitignore.
+       * examples/calc++/.gitignore (/calc++.exe): Add.  Reported by Eric
+       Blake.
+       * src/.gitignore (/bison.exe): Add.  Reported by Eric Blake.
+
+2008-07-15  Joel E. Denny  <address@hidden>
+
        Improve forward-compatibility with GNU M4.  Reported by Eric Blake at
        <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>.
        * bootstrap.conf (gnulib_modules): Add unsetenv.
diff --git a/bootstrap b/bootstrap
index 9923ff0..85d06a2 100755
--- a/bootstrap
+++ b/bootstrap
@@ -211,7 +211,7 @@ if test -n "$checkout_only_file" && test ! -r 
"$checkout_only_file"; then
   exit 1
 fi
 
-# If $STR is not already on a line by itself in $FILE, insert it,
+# If each line in $STR is not already on a line by itself in $FILE, insert it,
 # sorting the new contents of the file and replacing $FILE with the result.
 insert_sorted_if_absent() {
   file=$1
@@ -222,6 +222,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"
+  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 "$2" | sed s,^,/,`;;
+  *)
+    pattern="$2";;
+  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 \
@@ -240,7 +255,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
 
@@ -350,7 +365,7 @@ check_dst_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
 }
@@ -507,18 +522,18 @@ 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 _.h, then also add
        # the name with just ".h".  Many gnulib headers are generated,
        # e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc.
        # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
        f=`echo "$copied"|sed 
's/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
-       insert_sorted_if_absent $ig "$f"
+       insert_vc_ignore $ig "$f"
 
        # For files like sys_stat_.h and sys_time_.h, record as
        # ignorable the directory we might eventually create: sys/.
        f=`echo "$copied"|sed 's/sys_.*_\.h$/sys/'`
-       insert_sorted_if_absent $ig "$f"
+       insert_vc_ignore $ig "$f"
       fi
     done
   done
diff --git a/bootstrap.conf b/bootstrap.conf
index f443ccc..7cb7a12 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -65,3 +65,7 @@ excluded_files='
     m4/visibility.m4
     m4/xsize.m4
 '
+
+# In directories like lib/, m4/, and po/, generate both these files because we
+# still try to support CVS emulation.
+vc_ignore='.cvsignore .gitignore'
diff --git a/examples/calc++/.gitignore b/examples/calc++/.gitignore
index c0764ce..2050491 100644
--- a/examples/calc++/.gitignore
+++ b/examples/calc++/.gitignore
@@ -10,3 +10,4 @@
 /Makefile
 /Makefile.in
 /calc++
+/calc++.exe
diff --git a/lib/.gitignore b/lib/.gitignore
index 9d2d22d..fc74edb 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,5 +1,6 @@
 /*.a
 /*.o
+/*~
 /.deps
 /Makefile
 /Makefile.in
diff --git a/po/.cvsignore b/po/.cvsignore
index 648116e..db44d74 100644
--- a/po/.cvsignore
+++ b/po/.cvsignore
@@ -1,5 +1,7 @@
 *.gmo
 *.po
+*.po~
+.reference
 LINGUAS
 Makefile
 Makefile.in
diff --git a/runtime-po/.cvsignore b/runtime-po/.cvsignore
index 0317254..aad7a48 100644
--- a/runtime-po/.cvsignore
+++ b/runtime-po/.cvsignore
@@ -1,5 +1,7 @@
 *.gmo
 *.po
+*.po~
+.reference
 LINGUAS
 Makefile
 Makefile.in
diff --git a/src/.gitignore b/src/.gitignore
index 086efc9..1c1015b 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -6,6 +6,7 @@
 /Makefile
 /Makefile.in
 /bison
+/bison.exe
 /revision.c
 /scan-code.c
 /scan-gram.c
-- 
1.5.4.3





reply via email to

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