2007-08-24 Jim Meyering <jim@meyering.net>
+ Create .gitignore and/or .cvsignore from scratch, if absent.
+ This is in preparation for my removing those files from version
+ control in the directories managed by gnulib-tool.
+ * bootstrap: New setting: vc_ignore.
+ (insert_sorted_if_absent): Create $file if absent.
+ Adapt to new, possibly empty, list: $vc_ignore.
+
* src/system.h (fseeko, ftello): Remove now-unneeded definitions.
* src/od.c (LDBL_DIG): Remove now-unneeded definition.
# Whether to use copies instead of symlinks.
copy=false
+# Set this to '.cvsignore .gitignore' in bootstrap.conf if you want
+# those files to be generated in directories like lib/, m4/, and po/.
+# Or set it to 'auto' to make this script select which to use based
+# on which version control system (if any) is used in the source directory.
+vc_ignore=auto
+
# Override the default configuration, if necessary.
test -r bootstrap.conf && . ./bootstrap.conf
+if test "$vc_ignore" = auto; then
+ vc_ignore=
+ test -d .git && vc_ignore=.gitignore
+ test -d CVS && vc_ignore="$vc_ignore .cvsignore"
+fi
+
# Translate configuration into internal form.
# Parse options.
insert_sorted_if_absent() {
file=$1
str=$2
+ test -f $file || touch $file
echo "$str" | sort -u - $file | cmp -s - $file \
|| echo "$str" | sort -u - $file -o $file \
|| exit 1
# below will malfunction. If creating it, also mark it as ignored.
if test ! -d $build_aux; then
mkdir $build_aux
- for ig in .cvsignore .gitignore; do
- test -f $ig && insert_sorted_if_absent $ig $build_aux
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
+ insert_sorted_if_absent $dot_ig $build_aux
done
fi
fi || exit
done
- for dot_ig in .cvsignore .gitignore; do
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
ig=$dir/$dot_ig
- if test -n "$copied" && test -f $ig; then
+ if test -n "$copied"; then
insert_sorted_if_absent $ig "$copied"
# If an ignored file name ends with _.h, then also add
# the name with just ".h". Many gnulib headers are generated,