From: Alexandre Julliard <julliard@winehq.org>
To: git@vger.kernel.org
Subject: [PATCH] pack-refs: Store the full name of the ref even when packing only tags.
Date: Thu, 02 Nov 2006 12:13:32 +0100 [thread overview]
Message-ID: <871wom5cf7.fsf@wine.dyndns.org> (raw)
Using for_each_tag_ref() to enumerate tags is wrong since it removes
the refs/tags/ prefix, we need to always use for_each_ref() and filter
out non-tag references in the callback.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
builtin-pack-refs.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 1087657..042d271 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -12,6 +12,7 @@ struct ref_to_prune {
struct pack_refs_cb_data {
int prune;
+ int all;
struct ref_to_prune *ref_to_prune;
FILE *refs_file;
};
@@ -29,6 +30,8 @@ static int handle_one_ref(const char *pa
{
struct pack_refs_cb_data *cb = cb_data;
+ if (!cb->all && strncmp(path, "refs/tags/", 10))
+ return 0;
/* Do not pack the symbolic refs */
if (!(flags & REF_ISSYMREF))
fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
@@ -68,7 +71,6 @@ int cmd_pack_refs(int argc, const char *
{
int fd, i;
struct pack_refs_cb_data cbdata;
- int (*iterate_ref)(each_ref_fn, void *) = for_each_tag_ref;
memset(&cbdata, 0, sizeof(cbdata));
@@ -79,7 +81,7 @@ int cmd_pack_refs(int argc, const char *
continue;
}
if (!strcmp(arg, "--all")) {
- iterate_ref = for_each_ref;
+ cbdata.all = 1;
continue;
}
/* perhaps other parameters later... */
@@ -93,7 +95,7 @@ int cmd_pack_refs(int argc, const char *
if (!cbdata.refs_file)
die("unable to create ref-pack file structure (%s)",
strerror(errno));
- iterate_ref(handle_one_ref, &cbdata);
+ for_each_ref(handle_one_ref, &cbdata);
fflush(cbdata.refs_file);
fsync(fd);
fclose(cbdata.refs_file);
--
1.4.3.3.gac1f
--
Alexandre Julliard
reply other threads:[~2006-11-02 11:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=871wom5cf7.fsf@wine.dyndns.org \
--to=julliard@winehq.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.
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).