git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Storing state in $GIT_DIR

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Aug 26, 2005, 01:30 UTC
Message-ID
<46a038f905082518306e9d7d2a@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.58.0508251053000.3317@g5.osdl.org>
Linus, 

I like the solution you are suggesting, but I suspect it will create more problems that it will solve, and while the coolness factor is drawing me in.... we ain't gonna need it, as the xp people say.

More below...
On 8/26/05, Linus Torvalds <torvalds@osdl.org> wrote:
> Git won't care, so it will work, but things like clone/pull etc also won't
> actually ever look there, so it will only work for that one repo.

Storing things there _works_ in the sense that it will be ignored, and that is fine with me. So I could just be lazy and have it strictly tied to the repo. In practice, if you are tracking an external Arch repo, you really have it scripted, and use a dedicated git repo for that.

Not using a dedicated repo is quite... messy. If you do other things in that particular repo, the import script may find it dirty, and mess things up on import. And after the import, you'll probably run git-push-script --all because it's bringing a dynamically growing forest of heads from the arch repo. That's another reason why your private branches should be elsewhere.

OTOH, storing the metadata in a branch will allow us to run the import in alternating repositories. But as Junio points out, unless I can guarantee that the metadata and the tree are in sync, I cannot trivially resume the import cycle from a new repo.

Show 5 quoted lines
> The git solution to this (which nobody has ever _used_, but which
> technically is wonderful) is to have a "side branch" that does not share
> any commits (or files, for that matter) in common with the "real branch",
> and which is used to track any metadata. In fact, you can obviously have
> any number of side branches.

A couple of days ago, playing with the import, I realised that the git repo can hold unrelated projects, too, if you just commit orphan trees as new heads. I mean - it was a bug in my script but I thought it was cool. ;)

> The way to maintain a metadata branch is to have not only a different
> branch name (obviously), but also use a totally different index file, so
> that you can index both branches in parallell, and you don't actually need
> to check out one or the other.

Hmmm. Now that's voodoo magic! I was thinking of reading the file by asking directly for the object by its sha, or doing a checkout in a tmpdir. Interesting.

cheers,
martin
Previous: Linus TorvaldsNext: Linus Torvalds
Message 3 of 17 in “Storing state in $GIT_DIR”
  1. Martin LanghoffAug 25, 2005
  2. Linus TorvaldsAug 25, 2005
  3. Martin LanghoffAug 26, 2005
  4. Linus TorvaldsAug 26, 2005
  5. Martin LanghoffAug 26, 2005
  6. Junio C HamanoAug 26, 2005
  7. Daniel BarkalowAug 26, 2005
  8. Linus TorvaldsAug 26, 2005
  9. Junio C HamanoAug 26, 2005
  10. Linus TorvaldsAug 27, 2005
  11. Junio C HamanoAug 26, 2005
  12. Martin LanghoffAug 26, 2005
  13. Eric W. BiedermanAug 26, 2005
  14. Martin LanghoffAug 26, 2005
  15. Eric W. BiedermanAug 26, 2005
  16. Accept -m and friends for initial commits and merge commits.Junio C Hamano, Aug 26, 2005
  17. Martin LanghoffAug 26, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.