From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
Sverre Rabbelier <srabbelier@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
Elijah Newren <newren@gmail.com>,
Thiago Farina <tfransosi@gmail.com>
Subject: [PATCH v6 p2 7/9] fast-export: make extra_refs global
Date: Sat, 24 Nov 2012 04:25:18 +0100 [thread overview]
Message-ID: <1353727520-26039-8-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1353727520-26039-1-git-send-email-felipe.contreras@gmail.com>
There's no need to pass it around everywhere. This would make easier
further refactoring that makes use of this variable.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
builtin/fast-export.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 77dffd1..5035382 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -30,6 +30,7 @@ static int fake_missing_tagger;
static int use_done_feature;
static int no_data;
static int full_tree;
+static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
static int parse_opt_signed_tag_mode(const struct option *opt,
const char *arg, int unset)
@@ -474,8 +475,7 @@ static void handle_tag(const char *name, struct tag *tag)
(int)message_size, (int)message_size, message ? message : "");
}
-static void get_tags_and_duplicates(struct rev_cmdline_info *info,
- struct string_list *extra_refs)
+static void get_tags_and_duplicates(struct rev_cmdline_info *info)
{
struct tag *tag;
int i;
@@ -502,7 +502,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,
/* handle nested tags */
while (tag && tag->object.type == OBJ_TAG) {
parse_object(tag->object.sha1);
- string_list_append(extra_refs, full_name)->util = tag;
+ string_list_append(&extra_refs, full_name)->util = tag;
tag = (struct tag *)tag->tagged;
}
if (!tag)
@@ -532,20 +532,20 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,
* sure it gets properly updated eventually.
*/
if (commit->util || commit->object.flags & SHOWN)
- string_list_append(extra_refs, full_name)->util = commit;
+ string_list_append(&extra_refs, full_name)->util = commit;
if (!commit->util)
commit->util = full_name;
}
}
-static void handle_tags_and_duplicates(struct string_list *extra_refs)
+static void handle_tags_and_duplicates(void)
{
struct commit *commit;
int i;
- for (i = extra_refs->nr - 1; i >= 0; i--) {
- const char *name = extra_refs->items[i].string;
- struct object *object = extra_refs->items[i].util;
+ for (i = extra_refs.nr - 1; i >= 0; i--) {
+ const char *name = extra_refs.items[i].string;
+ struct object *object = extra_refs.items[i].util;
switch (object->type) {
case OBJ_TAG:
handle_tag(name, (struct tag *)object);
@@ -638,7 +638,6 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
struct object_array commits = OBJECT_ARRAY_INIT;
- struct string_list extra_refs = STRING_LIST_INIT_NODUP;
struct commit *commit;
char *export_filename = NULL, *import_filename = NULL;
struct option options[] = {
@@ -688,7 +687,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
if (import_filename && revs.prune_data.nr)
full_tree = 1;
- get_tags_and_duplicates(&revs.cmdline, &extra_refs);
+ get_tags_and_duplicates(&revs.cmdline);
if (prepare_revision_walk(&revs))
die("revision walk setup failed");
@@ -704,7 +703,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
}
}
- handle_tags_and_duplicates(&extra_refs);
+ handle_tags_and_duplicates();
if (export_filename)
export_marks(export_filename);
--
1.8.0
next prev parent reply other threads:[~2012-11-24 3:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-24 3:25 [PATCH v6 p2 0/9] transport-helper and fast-export fixes Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 1/9] transport-helper: update remote helper namespace Felipe Contreras
2012-11-24 3:28 ` Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 2/9] fast-export: don't handle uninteresting refs Felipe Contreras
2012-11-24 3:27 ` Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 3/9] transport-helper: trivial code shuffle Felipe Contreras
2012-11-27 17:00 ` Junio C Hamano
2012-11-28 0:05 ` Felipe Contreras
2012-11-28 1:54 ` Junio C Hamano
2012-11-28 2:15 ` Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 4/9] transport-helper: fix push without refspec Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 5/9] transport-helper: fix pushing with straight refspec Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 6/9] transport-helper: fix push without marks Felipe Contreras
2012-11-24 3:25 ` Felipe Contreras [this message]
2012-11-24 3:25 ` [PATCH v6 p2 8/9] fast-export: refactor get_tags_and_duplicates() Felipe Contreras
2012-11-24 3:25 ` [PATCH v6 p2 9/9] fast-export: trivial cleanups Felipe Contreras
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=1353727520-26039-8-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ilari.liusvaara@elisanet.fi \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=srabbelier@gmail.com \
--cc=tfransosi@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.
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).