From: Brent Goodrick <bgoodr@gmail.com>
To: git@vger.kernel.org
Subject: How do I qualify paths in the .gitignore file w.r.t. the repo root directory?
Date: Mon, 23 Feb 2009 22:47:13 -0800 [thread overview]
Message-ID: <e38bce640902232247t63a37f63x9f403fbda0744cfd@mail.gmail.com> (raw)
Say I have these files and directories [2]:
/home/smart_tator/misc_files/.gitignore
/home/smart_tator/misc_files/foo/
/home/smart_tator/misc_files/bar/
/home/smart_tator/misc_files/bar/baz/foo/
/home/smart_tator/misc_files/bar/baz/real/
then I do:
cd /home/smart_tator/misc_files/; git init
and say I have this line in that .gitignore file:
foo/
And then I naively execute:
git add bar/
then the bar/baz/real/ is added, but these are dutifully ignored:
/home/smart_tator/misc_files/foo/
/home/smart_tator/misc_files/bar/baz/foo/
But consider in my real repo, I have thousands of files, versus the
Tinker Toy example shown above. And consider that I don't know about
that bar/baz/foo/ exists ahead of time, because I'm not the only
developer checking in content to the repo that might contain precious
"foo/"'s to keep. I can't move my top level foo/, as I have tools that
rely upon that foo/ being in its place.
That means that we can't solve this problem efficiently/effectively
with the negation operator in the .gitignore file:
foo/
!bar/baz/foo/
because sooner or later someone is going to get surprised as to why
their foo/ isn't being added in some other subdirectory, and they will
"fix it" by committing a change where they have removed the foo/ from
the .gitignore file, thus causing the top level foo/ to show up as
candidates for addition in git status output.
Is there some way to express that the foo/ that is to be ignored is
always the one in /home/smart_tator/misc_files/ directory, but all
other foo/ subdirectories in any other directory under consideration
should still continue to participate in adds and merges, all without
having to "over-express" the exceptions with negation operators?
Maybe the imaginary .gitignore syntax I am thinking of would be one of
the following (most of these are just silly/fun):
</>foo/ # <-- Huh?
<top>foo/ # <-- What the ...?
//foo/ # <-- Smells like Perforce or Windows UNC paths
/foo/ # <-- No! Matches UNIX root filesystem directory paths!
>foo/ # <-- You can't have a > character in DOS or Unix paths, can you?
$root/foo/ # <-- I like this syntax the best [1]
Thanks,
bg
[1] Maybe there are other "variables" besides $root that might be
useful to be added in the future, like $HOME.
[2] By "repo root directory", I mean whatever "$GIT_DIR/.." resolves to.
next reply other threads:[~2009-02-24 6:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-24 6:47 Brent Goodrick [this message]
2009-02-24 7:06 ` How do I qualify paths in the .gitignore file w.r.t. the repo root directory? Junio C Hamano
2009-02-24 9:07 ` Sitaram Chamarty
2009-02-24 17:33 ` Junio C Hamano
2009-02-24 18:31 ` Sitaram Chamarty
2009-02-25 3:31 ` Sitaram Chamarty
2009-02-25 8:36 ` Junio C Hamano
2009-02-25 11:17 ` Sitaram Chamarty
2009-02-25 21:25 ` Junio C Hamano
2009-02-26 0:45 ` Björn Steinbrink
2009-02-26 1:23 ` Sitaram Chamarty
2009-02-26 3:48 ` Sitaram Chamarty
2009-02-26 17:04 ` Junio C Hamano
2009-02-25 1:14 ` Brent Goodrick
2009-02-25 4:01 ` Sitaram Chamarty
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e38bce640902232247t63a37f63x9f403fbda0744cfd@mail.gmail.com \
--to=bgoodr@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).