refspec: s/refspec_item_init/&_or_die/g

Rename the refspec_item_init() function introduced in 6d4c057859 ("refspec: introduce struct refspec", 2018-05-16) to refspec_item_init_or_die(). This follows the convention of other *_or_die() functions, and is done in preparation for making it a wrapper for a non-fatal variant. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jun 5, 2018 at 19:54 UTC dc0642218306190a2d284f47f75d71aeeaa34d02
4 files changed +7 -5
builtin/clone.c
+1 -1
@@ -1077,7 +1077,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
1077 if (option_required_reference.nr || option_optional_reference.nr)
1078 setup_reference();
1079
1080 - refspec_item_init(&refspec, value.buf, REFSPEC_FETCH);
1080 + refspec_item_init_or_die(&refspec, value.buf, REFSPEC_FETCH);
1081
1082 strbuf_reset(&value);
1083
builtin/pull.c
+1 -1
@@ -680,7 +680,7 @@ static const char *get_tracking_branch(const char *remote, const char *refspec)
680 const char *spec_src;
681 const char *merge_branch;
682
683 - refspec_item_init(&spec, refspec, REFSPEC_FETCH);
683 + refspec_item_init_or_die(&spec, refspec, REFSPEC_FETCH);
684 spec_src = spec.src;
685 if (!*spec_src || !strcmp(spec_src, "HEAD"))
686 spec_src = "HEAD";
refspec.c
+3 -2
@@ -122,7 +122,8 @@ static int parse_refspec(struct refspec_item *item, const char *refspec, int fet
122 return 1;
123 }
124
125 -void refspec_item_init(struct refspec_item *item, const char *refspec, int fetch)
125 +void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
126 + int fetch)
127 {
128 memset(item, 0, sizeof(*item));
129
@@ -150,7 +151,7 @@ void refspec_append(struct refspec *rs, const char *refspec)
151 {
152 struct refspec_item item;
153
153 - refspec_item_init(&item, refspec, rs->fetch);
154 + refspec_item_init_or_die(&item, refspec, rs->fetch);
155
156 ALLOC_GROW(rs->items, rs->nr + 1, rs->alloc);
157 rs->items[rs->nr++] = item;
refspec.h
+2 -1
@@ -32,7 +32,8 @@ struct refspec {
32 int fetch;
33 };
34
35 -void refspec_item_init(struct refspec_item *item, const char *refspec, int fetch);
35 +void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
36 + int fetch);
37 void refspec_item_clear(struct refspec_item *item);
38 void refspec_init(struct refspec *rs, int fetch);
39 void refspec_append(struct refspec *rs, const char *refspec);