Re: [PATCH] Document escaping of special characters in gitignore files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 5, 2011, 18:42 UTC
- Message-ID
- <7vwrmjchuu.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1294234732-20094-1-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 6 quoted lines
> This patch was originally send 10 Sep 2010, but I guess it was lost > because it appeared only deep in thread inside response, and not as > well separated patch. I have found about it when I got conflict > merging current code. > > It applies on top of current 'master'.
Thanks. A few questions before applying.
Show 9 quoted lines
> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt > index 7dc2e8b..20abc20 100644 > --- a/Documentation/gitignore.txt > +++ b/Documentation/gitignore.txt > @@ -68,6 +68,7 @@ Patterns have the following format: > for readability. > > - A line starting with # serves as a comment. > + Use `\#` for a literal # character starting filename.
Is a literal bs safe here? You later use "{backslash}#" in this same file, and it might make sense to do so here for the sake of source readability, even if a literal bs is safe here---provided that "{backslash}#" does not break here, of course.
Show 5 quoted lines
> @@ -98,6 +99,12 @@ Patterns have the following format:
> ...
> + - You can escape special characters using backslash.
> + For example, "{backslash}#*" matches files beginning in `#`
> ...Show 9 quoted lines
> diff --git a/templates/info--exclude b/templates/info--exclude > index a5196d1..2ebaf0d 100644 > --- a/templates/info--exclude > +++ b/templates/info--exclude > @@ -4,3 +4,4 @@ > # exclude patterns (uncomment them if you want to use them): > # *.[oa] > # *~ > +# \#*#
Do we need this? Without explanation it is somewhat hard to realize that this last line is also an example of a pattern that excludes any filename that begins and ends with a pound.