Collin Funk wrote:
> sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
> if test -n "$anchor"; then sed -e 's,/,\\/,g' -e
> "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi
>
> Which uses sed expressions to create sed expressions right? Like this:
>
> # No anchor
> abc -> /^abc$/d
> # Anchor
> /abc -> /^\/abc$/d
Right. This sed expression is supposed to remove a line 'abc' or '/abc',
respectively.
> I think something about using sed to create sed expressions broke my
> brain a bit.
:-D Well, that's the principle of a von-Neumann computer: that a program
(consisting of instructions) can assemble other instructions, to form a new
program. For CPU instructions, it's a well-known technique. For 'sed'
programs, apparently not...
> Would this diff be correct or am I missing something? It seems that it
> makes the .gitignores in the test suite correct.
>
> diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
> index 85ec0a61db..7736a95389 100644
> --- a/pygnulib/GLImport.py
> +++ b/pygnulib/GLImport.py
> @@ -809,7 +809,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
> if filename.strip() }
> srcdata = lines_to_multiline(sorted(dirs_ignore))
> dirs_ignore = [ '%s%s' % (anchor, d)
> - for d in
> set(files_added).difference(dirs_ignore) ]
> + for d in
> set(files_added).difference(dirs_ignore).difference(files_removed) ]
> destdata = lines_to_multiline(sorted(dirs_ignore))
The .difference(files_removed)
or maybe .difference(set(files_removed))
goes into the right direction. I haven't checked the other variables and how
they need to be chained together.
> Using the wget2 test:
>
> Files ./test-wget2-1.result/.gitignore~ and tmp53401-result/.gitignore~ differ
> Only in tmp53401-result/build-aux: .gitignore~
I haven't looked. I'm concentrating on the create-tests, and leave the
import-tests to you.
Bruno