git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Newbie .gitignore problem
@ 2010-09-22 16:41 Jonathan Gossage
  2010-09-22 19:44 ` Kevin Ballard
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Gossage @ 2010-09-22 16:41 UTC (permalink / raw
  To: git

I am having a problem specifying .gitignore filters properly
I have a directory structure as follows:

          repo-root
               |
               -------------------------------------------------------------------
               |                    |
           |
              dir1               dir2  (symlink)
             dir3
                                    |
                ---------------------------------------------------
               |                                                   |
          many directories and files                  dir4

My problem is that I want to exclude all files and sub-directories in dir2
except for dir4 from control by Git.
I tried a number of variations on the following .gitignore file in dir2 but
either everything was excluded or everything was included. I tested using
git add -uall -n

The final .gitignore file was
*
*/*
!dir4


How should I go about tackling this. The .gitignore man pages were
unclear to me.

Jonathan Gossage

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Newbie .gitignore problem
  2010-09-22 16:41 Newbie .gitignore problem Jonathan Gossage
@ 2010-09-22 19:44 ` Kevin Ballard
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Ballard @ 2010-09-22 19:44 UTC (permalink / raw
  To: Jonathan Gossage; +Cc: git

Git tracks symlinks the same way it tracks files. It'll record the contents of the symlink (the path it points to) as a blob, and then record the symlink itself with a special mode to indicate that it is a symlink. This means that if your symlink points outside of the repository, nothing pointed to by it will even be examined by git. And if it symlinks another dir in the repo, but the contents of that dir are excluded via your gitignore, anything inside the dir will still be excluded. With this in mind, it appears from your diagram that dir2 is likely to be pointing outside of the repository, and so dir4 is never even seen by git.

-Kevin Ballard

On Sep 22, 2010, at 9:41 AM, Jonathan Gossage wrote:

> I am having a problem specifying .gitignore filters properly
> I have a directory structure as follows:
> 
>           repo-root
>                |
>                -------------------------------------------------------------------
>                |                    |
>           |
>               dir1               dir2  (symlink)
>              dir3
>                                     |
>                 ---------------------------------------------------
>                |                                                   |
>           many directories and files                  dir4
> 
> My problem is that I want to exclude all files and sub-directories in dir2
> except for dir4 from control by Git.
> I tried a number of variations on the following .gitignore file in dir2 but
> either everything was excluded or everything was included. I tested using
> git add -uall -n
> 
> The final .gitignore file was
> *
> */*
> !dir4
> 
> 
> How should I go about tackling this. The .gitignore man pages were
> unclear to me.
> 
> Jonathan Gossag--
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> e

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-22 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22 16:41 Newbie .gitignore problem Jonathan Gossage
2010-09-22 19:44 ` Kevin Ballard

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).