git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Jaeger <christian@pflanze.mine.nu>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Marc Feeley <feeley@iro.umontreal.ca>,
	Gambit List <Gambit-list@iro.umontreal.ca>
Subject: Re: [gambit-list] Separating generated files?
Date: Thu, 16 Oct 2008 14:00:45 +0200	[thread overview]
Message-ID: <48F72CED.6030508@pflanze.mine.nu> (raw)
In-Reply-To: <48F62834.9080102@pflanze.mine.nu>

I wrote:
> Michael J Gruber wrote:
>> I wonder whether a clever use of "excludes" and GIT_DIR would allow
>> tracking the different filesets in the same dir, but using different
>> repos. I'm just afraid it's a fragile setup, in the sense that it relies
>> on config stuff which is not tracked (and thus not reproduced
>> automatically on clone).
>
> I expect that using a superproject repository to tie together the two 
> repositories is good and necessary because it is the link that allows 
> to specify which commit in the repo of generated files belongs 
> together with a commit in the repo of source files. So just using two 
> separate repositories without making them submodules of a superproject 
> does not seem to be a good idea to me.

(In the meantime I've read the following pages:
http://nopugs.com/2008/09/06/ext-tutorial
http://nopugs.com/2008/09/04/why-ext
http://flavoriffic.blogspot.com/2008/05/managing-git-submodules-with-gitrake.html
(a post to the latter article suggests to use subtree merging instead, 
but that would be a very bad match for our use case; the mentioned 
problem of merging of the git superproject makes me think, though--the 
superproject could be updated only by the one person doing the publish 
onto the public repository, but then it leaves the problem of handling 
merges by developers completely unsolved.)
)

I'm starting to think that maybe a better idea than the 
superproject+2submodules approach would be just using the two 
repositories ("source" + "build"), and storing the linking information 
inside the "build" repository (by adding the source repository commitid 
to every commit message in the build repository [or using tags, but that 
doesn't seem a better idea]), and use a program that is able to check 
out the matching "build" repository for a given "source" repository 
checkout.

I'm willing to write this program (let's call it 
"intergit-find-matching-commit-in" for the purpose of this email); 
question: which language to write it in, is Perl good? (C would be a 
hassle for Windows users because of the C compiler requirement; shell 
may be too limited.)

Description of the workings in more detail:

- one would work with the "source" repository just as one would with any 
project only employing one repository; do some changes to the project, 
commit them, test them (includes regeneration of generated files);

- once in a while one would commit the current generated files in the 
"build" repository; by either (a) using a make target (like "make 
commit_generated") which runs something like

  eval "cd build; git commit -m 'generated files for source repository 
commit `git rev-parse HEAD`'"

or (b) setting up a build/.git/hooks/commit-msg script which appends 
'generated files for source repository commit `git rev-parse HEAD`' line 
to the commit message given from running "cd build; git commit -a" manually.

- for publication, one would push both the "source" as well as the 
"build" repository (i.e. "cd build; git push; cd ..; git push")

- for checkout (our "make update" make target), about the following 
would happen:

   git pull
   eval "(cd build; git checkout `intergit-find-matching-commit-in build`)"

where "intergit-find-matching-commit-in build" would first refresh an 
index of the links (iterate over all unseen commits, parse commit 
messages for /source repository commit (\w+)/ and store $1 => 
$commitid_in_build_repo mappings in the index), then go through "git log 
--pretty=format:%H" (should I also specify --topo-order (or 
--date-order)?) looking up the commitids in the index, stopping at the 
first match and outputting the mapped $commitid_in_build_repo.

This way, the "latest" or "probably best-matching" corresponding commit 
in the "build" repo can always be found, even if the "source" repo is 
ahead, which should allow building the compiler even if none is 
previously installed. This workflow seems more natural than the 
superproject+submodules approach, and it seems to entail no hassle with 
merge issues (only the "source" repo really needs proper merging; 
merging the "build" repo would only be worthwhile for maintaining the 
history, and as mentioned if there are conflicts, one would probably 
usually just regenerate the files there; there's no need to maintain 
linking info (with associated merge etc issues) in a separate entity 
(superproject) anymore, and during development, commits to the "build" 
repo need only be done if backwards-incompatible changes have been 
introduced).

Does anyone else think this is sane/interesting? Should I go ahead 
implementing this? Any comments, like on how the interface of the 
intergit-find-matching-commit-in tool should look like?

Christian.

  reply	other threads:[~2008-10-16 12:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E6D34628-783D-4597-8B00-C10F27F63BE2@iro.umontreal.ca>
     [not found] ` <48F5D86B.6040501@pflanze.mine.nu>
2008-10-15 14:54   ` Separating generated files? (Re: Mercurial -> git) Nguyen Thai Ngoc Duy
2008-10-15 15:30     ` [gambit-list] " Matthieu Moy
2008-10-15 16:42       ` Michael J Gruber
2008-10-15 17:28         ` Christian Jaeger
2008-10-16 12:00           ` Christian Jaeger [this message]
2008-10-16 12:12             ` [gambit-list] Separating generated files? Santi Béjar
2008-10-16 12:32               ` Christian Jaeger
2008-10-16 13:29                 ` Santi Béjar
2008-10-15 16:45       ` Christian Jaeger

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=48F72CED.6030508@pflanze.mine.nu \
    --to=christian@pflanze.mine.nu \
    --cc=Gambit-list@iro.umontreal.ca \
    --cc=Matthieu.Moy@imag.fr \
    --cc=feeley@iro.umontreal.ca \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@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.
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).