summaryrefslogtreecommitdiff
path: root/builtin-pack-refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-11-21 23:36:35 -0800
committerJunio C Hamano <junkio@cox.net>2006-11-21 23:37:35 -0800
commitf4204ab9f6a192cdb9a68150e031d7183688bfeb (patch)
tree3c9402e5a9e55dadf6477e44904fcc86fac7c8be /builtin-pack-refs.c
parentcf0adba7885342e1bbcf0689fece9d13e39784b4 (diff)
downloadgit-f4204ab9f6a192cdb9a68150e031d7183688bfeb.tar.gz
Store peeled refs in packed-refs (take 2).
This fixes the previous implementation which failed to optimize repositories with tons of lightweight tags. The updated packed-refs format begins with "# packed-refs with:" line that lists the kind of extended data the file records. Currently, there is only one such extension defined, "peeled". This stores the "peeled tag" on a line that immediately follows a line for a tag object itself in the format "^<sha-1>". The header line itself and any extended data are ignored by older implementation, so packed-refs file generated with this version can still be used by older git. packed-refs made by older git can of course be used with this version. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-refs.c')
-rw-r--r--builtin-pack-refs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index ee5a5565af..8dc5b9efff 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -46,8 +46,8 @@ static int handle_one_ref(const char *path, const unsigned char *sha1,
if (o->type == OBJ_TAG) {
o = deref_tag(o, path, 0);
if (o)
- fprintf(cb->refs_file, "%s %s^{}\n",
- sha1_to_hex(o->sha1), path);
+ fprintf(cb->refs_file, "^%s\n",
+ sha1_to_hex(o->sha1));
}
}
@@ -111,6 +111,10 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
if (!cbdata.refs_file)
die("unable to create ref-pack file structure (%s)",
strerror(errno));
+
+ /* perhaps other traits later as well */
+ fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");
+
for_each_ref(handle_one_ref, &cbdata);
fflush(cbdata.refs_file);
fsync(fd);