git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jakub Narebski <jnareb@gmail.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	Darren Cook <darren@dcook.org>,
	git@vger.kernel.org
Subject: Re: Bug Report: git add
Date: Mon, 11 Apr 2011 14:20:38 -0400	[thread overview]
Message-ID: <20110411182038.GA17928@sigill.intra.peff.net> (raw)
In-Reply-To: <7v1v18y8oc.fsf@alter.siamese.dyndns.org>

On Mon, Apr 11, 2011 at 10:55:31AM -0700, Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > Currently I have TODO file in gitweb/ subdirectory, which is stored in
> > gitweb/.git repository.  Still it doesn't prevent me from "git add"-ing
> > e.g. 'gitweb/gitweb.perl' to git repository itself.
> 
> I would have to say that it is somewhat a sensible thing to want to do
> from an individual contributor's point of view to keep track of personal
> notes on a subpart of a project in a separate repository.
> 
> It however directly contradicts with the approach I suggested earlier,
> which resulted in Peff's patch
> 
>   http://thread.gmane.org/gmane.comp.version-control.git/170937/focus=171040 
> 
> and will be broken, I think.

Interestingly, I came across a similar situation yesterday. I have a
project with asciidoc documentation, and I was looking at making the
built forms available on a separate ref (similar to how you do the
html/man docs in git). One way I came up was to make a repo in
"Documentation/.git" which ignored all of the "*.txt" sources (which
tracked by the main repo) but track all of the built "*.html" files
(which are ignored by the main repo).

Which is exactly the kind of setup my patch tries to declare invalid.
But then I decided that what I was considering was too gross and
error-prone, and maybe it _should_ be banned. :)

In particular, some flaws I considered are:

  1. it is easy to get meta-files like ".gitignore" mixed up
     between the two repositories. And in fact, you have no way in the
     sub-repository to ignore the files from the parent repository
     except by using the non-tracked $GIT_DIR/info/exclude file. And
     without that, you can never use "git clean" in the sub-repository.

  2. When you want to add/commit files in the sub-directory to the main
     repository, you must do so from _outside_ that directory. Otherwise
     git will find the sub-repository's .git dir and you accidentally
     add them to the sub-repository.

> If there is an equally easy way of keeping track of personal notes in a
> subpart of a larger project like you do, without having an unrelated .git/
> directory in a worktree that is controlled by a project and mixing files
> in a single directory in such a way that some belong to the main project
> while others belong to the unrelated "personal notes" project, I would
> rather see us recommend such an approach, and declare that your use case
> is forbidden, as it would give us a far easier to explain rule: "files in
> one directory can be controlled only by one .git/ directory".

It works fine if you just put the notes in their own directory, i.e.:

  git init gitweb/local &&
  $EDITOR gitweb/local/notes

And if you have just the single-file case, you can always do:

  ln -s local/notes gitweb/notes &&
  echo gitweb/notes >.git/info/exclude

to overlay it in the parent tree. You do have to chdir into the sub-repo
to actually commit, but that is a _good_ thing, because it means you're
not accidentally commiting changes to "gitweb.perl" to the sub-repo.

I do something similar with my config.mak, which I track in my own Meta
sub-repo but symlink into place in the main git repository.

-Peff

  reply	other threads:[~2011-04-11 18:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 23:18 Bug Report: git add Darren Cook
2011-04-06  5:52 ` Ramkumar Ramachandra
2011-04-10  7:48   ` Jakub Narebski
2011-04-10  8:29     ` Ramkumar Ramachandra
2011-04-11 17:55     ` Junio C Hamano
2011-04-11 18:20       ` Jeff King [this message]
2011-04-07  0:57 ` Jeff King
2011-04-07  1:09   ` Junio C Hamano
2011-04-07  1:12     ` Jeff King
2011-04-07  1:48     ` Jeff King
2011-04-07  7:28       ` Junio C Hamano
2011-04-08 19:15         ` Jeff King
2011-04-08 19:46           ` Jeff King

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=20110411182038.GA17928@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=darren@dcook.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    /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).