From: Juliusz Chroboczek <Juliusz.Chroboczek@pps.jussieu.fr>
To: Git Mailing List <git@vger.kernel.org>
Cc: darcs-devel@abridgegame.org
Subject: Darcs-git: a few notes for Git hackers
Date: Mon, 09 May 2005 20:01:25 +0200 [thread overview]
Message-ID: <7ihdhc5le2.fsf@lanthane.pps.jussieu.fr> (raw)
Hi,
Here are a few notes about Git that should probably be taken into
account by people working on Git itself or on Git wrappers. The notes
apply to Linus' Git-0.6, which is the code I'm using in Darcs-git;
some of them might no longer be applicable to Darcs.
1. Darcs-git uses the fact that Git updates are atomic when reading
from a Git repository. Darcs-git almost writes to Git repositories
atomically, with one exception: it performs a non-atomic
read/update/write cycle on .git/HEAD.
For that reason, I'm taking a high-level lock on .git repositories
whenever I write them. The lockfile is ``.git/lock''. I haven't
thought about whether Darcs can be easily coerced into accessing Git
repos atomically; have people writing Git wrappers found the need for
a global lock?
2. The files git.h and git.c in Darcs-git are a simple ``libgit'' that
contains just enough functionality for Darcs-git; they use the
functionality of sha1_file.c and read_cache.c from Git-0.6.
I've found a few problems with the interfaces in these files:
- the global variables sha1_file_directory, active_cache, active_nr
and active_alloc are not marked ``extern'' in cache.h. This breaks
linkers that don't grok common symbols, such as the one in GHCi
(silly GHCi).
- the function write_sha1_file takes the metadata and the data in a
contiguous buffer, which is a problem when the data has been
allocated by a higher layer. I'm currently working around the
problem by memcpy-ing everything into a temp buffer, but that's
obviously not a good thing. I don't care whether write_sha1_file
is changed to use a writev-like interface, or to take the metadata
explicitly (as in char *type, unsigned long length).
- there is no (usable) function to write a tree; there's the code in
write_tree.c, but it's not generally useful. See the function
``git_write_tree_done'' in git.c for the type of interface I'm
thinking of.
- there's no way to have multiple simultaneous caches, short of
hacking at the values of Git's global variables by hand.
As I'd rather not maintain my own version of Git, I'd be mighty
grateful if some friendly Git hacker could fix the above.
Juliusz
next reply other threads:[~2005-05-09 17:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-09 18:01 Juliusz Chroboczek [this message]
2005-05-09 21:28 ` Darcs-git: a few notes for Git hackers Petr Baudis
2005-05-09 22:08 ` Juliusz Chroboczek
2005-05-09 22:20 ` H. Peter Anvin
2005-05-09 22:46 ` Juliusz Chroboczek
2005-05-09 22:50 ` H. Peter Anvin
2005-05-09 23:08 ` Juliusz Chroboczek
2005-05-09 22:50 ` Brad Roberts
2005-05-09 23:02 ` Petr Baudis
2005-05-09 23:34 ` Junio C Hamano
2005-05-10 12:55 ` Brad Roberts
[not found] ` <Pine.LNX.4.44.0505141851340.2136-200000@bellevue.puremagic.com>
2005-05-15 9:11 ` Brad Roberts
2005-05-15 11:48 ` Petr Baudis
2005-05-15 19:06 ` Brad Roberts
2005-05-15 19:25 ` Junio C Hamano
2005-05-15 19:48 ` Petr Baudis
2005-05-15 20:10 ` Brad Roberts
2005-05-15 20:36 ` Junio C Hamano
2005-05-17 20:19 ` Petr Baudis
2005-05-17 20:21 ` Petr Baudis
2005-05-10 0:07 ` Daniel Barkalow
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=7ihdhc5le2.fsf@lanthane.pps.jussieu.fr \
--to=juliusz.chroboczek@pps.jussieu.fr \
--cc=darcs-devel@abridgegame.org \
--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).