[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool.sh in time
From: |
Bruno Haible |
Subject: |
gnulib-tool.sh in time |
Date: |
Thu, 11 Apr 2024 02:44:16 +0200 |
In the 'time' package, a .gitignore file does not end with a newline. And
while gnulib-tool.py adds a newline before adding more lines, gnulib.tool.sh
does not.
How to reproduce:
$ git clone https://git.savannah.gnu.org/git/time.git
$ cd time
Remove the duplicate /build-aux line from .gitignore.
$ GNULIB_TOOL_IMPL=sh ./bootstrap --no-git --gnulib-srcdir=$GNULIB_SRCDIR
Look at the last lines of .gitignore.
This patch fixes it.
2024-04-10 Bruno Haible <bruno@clisp.org>
gnulib-tool.sh: Handle .gitignore files that do not end in a newline.
* gnulib-tool.sh (func_import): If the .gitignore file ends with a
character other than a newline, add a newline before adding more lines.
diff --git a/gnulib-tool.sh b/gnulib-tool.sh
index a8075d991f..e99b8fff79 100755
--- a/gnulib-tool.sh
+++ b/gnulib-tool.sh
@@ -6263,6 +6263,9 @@ s,//*$,/,'
if test -n "$anchor"; then sed -e 's,/,\\/,g' -e
"s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi
} > "$tmp"/sed-ignore-removed
{ cat "$destdir/$dir$ignore"~
+ # Add a newline if the original $dir$ignore file ended
+ # with a character other than a newline.
+ if test `tail -c 1 < "$destdir/$dir$ignore"~ | tr -d '\n' |
wc -c` = 1; then echo; fi
sed -e "s|^|$anchor|" < "$tmp"/ignore-added
} | sed -f "$tmp"/sed-ignore-removed \
> "$destdir/$dir$ignore"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnulib-tool.sh in time,
Bruno Haible <=