git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Bruce Korb <bruce.korb@gmail.com>, git@vger.kernel.org
Subject: Re: How do I .gitignore files starting with "#"?
Date: Fri, 10 Sep 2010 21:33:17 +0200	[thread overview]
Message-ID: <201009102133.19427.jnareb@gmail.com> (raw)
In-Reply-To: <AANLkTimw5pzdGjiPps-CE1PJS1sBXYw3dE4vhdwm1CYP@mail.gmail.com>

On Fri, 10 Sep 2010, Ævar Arnfjörð Bjarmason wrote:
> On Fri, Sep 10, 2010 at 18:52, Jakub Narebski <jnareb@gmail.com> wrote:
> > Bruce Korb <bruce.korb@gmail.com> writes:
> >
> > > After trying lots of variations, I found it to be:
> > >
> > > \#*
> > >
> > > Not obvious and not easy to look up.  Please add it to your
> > > .git/info/exclude sample text.  Thanks!
> >
> > Well, it is quite obvious to me, as escaping special characters using
> > backslash is typical in Unix tools.  But you are right that this needs
> > to be documented.
> >
> > Perhaps something like this?  I am not sure about example in
> > .git/info/exclude skeleton
> >
> > -- >8 --
> > Subject: [PATCH] Document escaping of special characters in gitignore files
> >
> > Requested-by: Bruce Korb <bruce.korb@gmail.com>
> > Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> > ---
> >  Documentation/gitignore.txt |    6 ++++++
> >  templates/info--exclude     |    1 +
> >  2 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
> > index 7dc2e8b..67ae4d0 100644
> > --- a/Documentation/gitignore.txt
> > +++ b/Documentation/gitignore.txt
> > @@ -98,6 +98,12 @@ Patterns have the following format:
> >    For example, "/{asterisk}.c" matches "cat-file.c" but not
> >    "mozilla-sha1/sha1.c".
> >
> > + - You can escape special characters using backslash.
> > +   For example, "{backslash}#*" matches files beginning in `#`
> > +   (otherwise it would be considered comment),
> > +   and "{backslash}!*{backslash}?" matches files starting with `!`
> > +   (negate pattern prefix) and ending with `?` (glob wildcard).
> > +
> 
> Maybe fix this too in the same manpage:
> 
>     A line starting with # serves as a comment.
> 
> To:
> 
>     A line starting with # serves as a comment. Use \# for a literal #
> character. See ...

Something like this?
-- >8 --
Subject: [PATCH] Document escaping of special characters in gitignore files

Requested-by: Bruce Korb <bruce.korb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 Documentation/gitignore.txt |    6 ++++++
 templates/info--exclude     |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 7dc2e8b..67ae4d0 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -98,6 +98,12 @@ Patterns have the following format:
    For example, "/{asterisk}.c" matches "cat-file.c" but not
    "mozilla-sha1/sha1.c".
 
+ - You can escape special characters using backslash.
+   For example, "{backslash}#*" matches files beginning in `#`
+   (otherwise it would be considered comment),
+   and "{backslash}!*{backslash}?" matches files starting with `!`
+   (negate pattern prefix) and ending with `?` (glob wildcard).
+
 An example:
 
 --------------------------------------------------------------
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]
 # *~
+# \#*#
-- 
1.7.2.1

  parent reply	other threads:[~2010-09-10 19:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10 16:59 How do I .gitignore files starting with "#"? Bruce Korb
2010-09-10 18:52 ` Jakub Narebski
2010-09-10 18:59   ` Ævar Arnfjörð Bjarmason
2010-09-10 19:11     ` Bruce Korb
2010-09-10 19:41       ` Jakub Narebski
2010-09-10 19:33     ` Jakub Narebski [this message]
2010-09-10 19:56       ` Jakub Narebski
2010-09-10 20:52         ` Bruce Korb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201009102133.19427.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=avarab@gmail.com \
    --cc=bruce.korb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).