On 01/02/2013 06:15 AM, Pádraig Brady wrote:
+# Ensure that .gitignore is sorted alphabetically.
+sc_prohibit_unsorted_gitignore:
+ @t1=.gitignore; t2=.gitignore.sorted; \
+ LANG=C sort -u < $$t1 > $$t2; \
+ st=0; diff -u $$t1 $$t2 || st=1; \
+ rm -f $$t2; \
+ exit $$st
+
# Ensure that all version-controlled test cases are listed in
$(all_tests).
sc_tests_list_consistency:
@bs="\\"; \
The part above is probably best in gnulib/top/maint.mk
since that's where the sorted insertion is coming from.
No. .gitignore syntax has situations where it must NOT be sorted, and
adding this as a syntax check rule will prevent useful situations where
unsorted files make sense.
For example, in libvirt, we have the following in .gitignore:
...
/po/*
...
!/po/*.po
!/po/POTFILES.in
!/po/libvirt.pot
since libvirt likes to keep the .po files checked into git, but doesn't
want to explicitly enumerate up whatever cruft of the day that different
versions of gettext happen to also stick in that directory. But sorting
this directory would put the override inclusions _before_ the blanket
exclusion, and since git ignores files based on the _last_ rule present,
rather than the first, sorting would break this usage.