* How do I .gitignore files starting with "#"?
@ 2010-09-10 16:59 Bruce Korb
2010-09-10 18:52 ` Jakub Narebski
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Korb @ 2010-09-10 16:59 UTC (permalink / raw)
To: git
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!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
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
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2010-09-10 18:52 UTC (permalink / raw)
To: Bruce Korb; +Cc: git
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).
+
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
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:33 ` Jakub Narebski
0 siblings, 2 replies; 8+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-09-10 18:59 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Bruce Korb, git
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 ...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
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
1 sibling, 1 reply; 8+ messages in thread
From: Bruce Korb @ 2010-09-10 19:11 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Jakub Narebski, git
On Fri, Sep 10, 2010 at 11:59 AM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> 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.
Like cscope, for example?
"#what ever"
Others use:
./#whatever
/etc/fstab requires \octal escapes, and not \xFF.
There are many unix standards to choose from, hence my suggestion. :)
That backslashes are sometimes used meant I found it before pressing
"send".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
2010-09-10 18:59 ` Ævar Arnfjörð Bjarmason
2010-09-10 19:11 ` Bruce Korb
@ 2010-09-10 19:33 ` Jakub Narebski
2010-09-10 19:56 ` Jakub Narebski
1 sibling, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2010-09-10 19:33 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Bruce Korb, git
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
2010-09-10 19:11 ` Bruce Korb
@ 2010-09-10 19:41 ` Jakub Narebski
0 siblings, 0 replies; 8+ messages in thread
From: Jakub Narebski @ 2010-09-10 19:41 UTC (permalink / raw)
To: Bruce Korb; +Cc: Ævar Arnfjörð Bjarmason, git
Bruce Korb wrote:
> On Fri, Sep 10, 2010 at 11:59 AM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> 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.
>
> Like cscope, for example?
>
> "#what ever"
>
> Others use:
>
> ./#whatever
Actually "/#whatever" would also work, but it would have different meaning,
anchoring filename so only files in given directory matches.
>
> /etc/fstab requires \octal escapes, and not \xFF.
They are not escapes, but quoting of metacharacters (special characters).
>
> There are many unix standards to choose from, hence my suggestion. :)
> That backslashes are sometimes used meant I found it before pressing
> "send".
:-)
--
Jakub Narebski
Poland
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
2010-09-10 19:33 ` Jakub Narebski
@ 2010-09-10 19:56 ` Jakub Narebski
2010-09-10 20:52 ` Bruce Korb
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2010-09-10 19:56 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Bruce Korb, git
Jakub Narebski wrote:
> Something like this?
Err, rather 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 | 7 +++++++
templates/info--exclude | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
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.
- An optional prefix '!' which negates the pattern; any
matching file excluded by a previous pattern will become
@@ -98,6 +99,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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: How do I .gitignore files starting with "#"?
2010-09-10 19:56 ` Jakub Narebski
@ 2010-09-10 20:52 ` Bruce Korb
0 siblings, 0 replies; 8+ messages in thread
From: Bruce Korb @ 2010-09-10 20:52 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Ævar Arnfjörð Bjarmason, git
On Fri, Sep 10, 2010 at 12:56 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> Jakub Narebski wrote:
>
>> Something like this?
> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
> index 7dc2e8b..20abc20 100644
> --- a/Documentation/gitignore.txt
I think the prototype for info/exclude is a good idea, too.
>> /etc/fstab requires \octal escapes, and not \xFF.
>
> They are not escapes, but quoting of metacharacters (special characters).
./#
\#
"#"
\043
\x23
&35;
whatever you care to call it, however you spell it, the result is intended to be
the same: This sequence of characters is to be interpreted as part of the token
and not special annotation (or token separator) characters.
Anyway, thanks for fixing the doc. - Bruce
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-09-10 20:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-09-10 19:56 ` Jakub Narebski
2010-09-10 20:52 ` Bruce Korb
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).