Re: [PATCH] maint: fix alphabetical order in .gitignore
From:
Bernhard Voelker
Subject:
Re: [PATCH] maint: fix alphabetical order in .gitignore
Date:
Fri, 11 Jan 2013 16:52:22 +0100
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0
On 01/11/2013 01:26 PM, PƔdraig Brady wrote:
> One issue is if there were existing duplicate entries
> in .gitignore, then the counts would be inaccurate.
> That might be guarded with something like:
>
> duplicate_entries=$(sort .gitignore | uniq -d)
> if [ "$duplicate_entries" ] ; then
> echo "Error: Duplicate entries in .gitignore: " $duplicate_entries >&2
> exit 1
> fi
Thanks, that's right.
I've folded it in a more general form into the attached new
version of the patch, i.e. s/.gitignore/$file/g, together with
a "Improved-by" line:
+ duplicate_entries=$(sort $file | uniq -d)
+ if [ "$duplicate_entries" ] ; then
+ echo "Error: Duplicate entries in $file: " $duplicate_entries >&2
+ exit 1
+ fi
> BTW changes to bootstrap go through gnulib first
> and are synced from there, so when this is sorted
> (no pun intended) I'll propose it to gnulib too.
Thanks. A little merging will be necessary ... since the
introduction of warn+die in gnulib's bootstrap.
> p.s. While this removes the sorted requirement, it still
> sorts the file on insertion. That's not a new restriction
> but it does mess up/preclude the use of comments and separator
> lines in .gitignore. In future it might be better to
> auto generate something like this at the top of .gitignore:
>
> ## Inserted by bootstrap ##
> entry1
> blank_line_after_last_entry
>
> To do that, you'd also have to remove existing
> entries in .gitignore corresponding to the above section.
Yes, that sounds like a cleaner solution, although the details
may be tricky, e.g. if a manual entry contradicts to an
automatically added one. Can this happen?
Have a nice day,
Berny