Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
fast-export: convert to use struct refspec
author
Brandon Williams
<bmwill@google.com>
Wed, 16 May 2018 22:57:59 +0000
(15:57 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 17 May 2018 21:19:42 +0000
(06:19 +0900)
Convert fast-export to use 'struct refspec' instead of using a list of
refspec_item's.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-export.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
eace274
)
diff --git
a/builtin/fast-export.c
b/builtin/fast-export.c
index 6f105dc7985c32a412109adb80cacb40140b74dd..143999738e352088c774e513fb25611812615e3a 100644
(file)
--- a/
builtin/fast-export.c
+++ b/
builtin/fast-export.c
@@
-36,8
+36,7
@@
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 no_data;
static int full_tree;
static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
-static struct refspec_item *refspecs;
-static int refspecs_nr;
+static struct refspec refspecs = REFSPEC_INIT_FETCH;
static int anonymize;
static int parse_opt_signed_tag_mode(const struct option *opt,
static int anonymize;
static int parse_opt_signed_tag_mode(const struct option *opt,
@@
-830,9
+829,9
@@
static void get_tags_and_duplicates(struct rev_cmdline_info *info)
if (dwim_ref(e->name, strlen(e->name), &oid, &full_name) != 1)
continue;
if (dwim_ref(e->name, strlen(e->name), &oid, &full_name) != 1)
continue;
- if (refspecs) {
+ if (refspecs
.nr
) {
char *private;
char *private;
- private = apply_refspecs(refspecs
, refspecs_
nr, full_name);
+ private = apply_refspecs(refspecs
.items, refspecs.
nr, full_name);
if (private) {
free(full_name);
full_name = private;
if (private) {
free(full_name);
full_name = private;
@@
-978,8
+977,8
@@
static void import_marks(char *input_file)
static void handle_deletes(void)
{
int i;
static void handle_deletes(void)
{
int i;
- for (i = 0; i < refspecs
_
nr; i++) {
- struct refspec_item *refspec = &refspecs[i];
+ for (i = 0; i < refspecs
.
nr; i++) {
+ struct refspec_item *refspec = &refspecs
.items
[i];
if (*refspec->src)
continue;
if (*refspec->src)
continue;
@@
-1040,18
+1039,12
@@
int cmd_fast_export(int argc, const char **argv, const char *prefix)
usage_with_options (fast_export_usage, options);
if (refspecs_list.nr) {
usage_with_options (fast_export_usage, options);
if (refspecs_list.nr) {
- const char **refspecs_str;
int i;
int i;
- ALLOC_ARRAY(refspecs_str, refspecs_list.nr);
for (i = 0; i < refspecs_list.nr; i++)
for (i = 0; i < refspecs_list.nr; i++)
- refspecs_str[i] = refspecs_list.items[i].string;
-
- refspecs_nr = refspecs_list.nr;
- refspecs = parse_fetch_refspec(refspecs_nr, refspecs_str);
+ refspec_append(&refspecs, refspecs_list.items[i].string);
string_list_clear(&refspecs_list, 1);
string_list_clear(&refspecs_list, 1);
- free(refspecs_str);
}
if (use_done_feature)
}
if (use_done_feature)
@@
-1090,7
+1083,7
@@
int cmd_fast_export(int argc, const char **argv, const char *prefix)
if (use_done_feature)
printf("done\n");
if (use_done_feature)
printf("done\n");
-
free_refspec(refspecs_nr,
refspecs);
+
refspec_clear(&
refspecs);
return 0;
}
return 0;
}