refspec: s/refspec_item_init/&_or_die/g
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 5 Jun 2018 19:54:38 +0000 (19:54 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Jun 2018 17:11:29 +0000 (10:11 -0700)
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>
builtin/clone.c
builtin/pull.c
refspec.c
refspec.h
index 8c5f4d8f074f13c62b7d6d5a3ea4deff80de2d58..05cd23097378db16e4273679e867d051b2b8c63a 100644 (file)
@@ -1077,7 +1077,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        if (option_required_reference.nr || option_optional_reference.nr)
                setup_reference();
 
-       refspec_item_init(&refspec, value.buf, REFSPEC_FETCH);
+       refspec_item_init_or_die(&refspec, value.buf, REFSPEC_FETCH);
 
        strbuf_reset(&value);
 
index 09575fd23ce75b4bbf4e6a541649adc2f2107cba..af9306ecdc1616d3cae19825b1ba6f4c8ef8ccf2 100644 (file)
@@ -680,7 +680,7 @@ static const char *get_tracking_branch(const char *remote, const char *refspec)
        const char *spec_src;
        const char *merge_branch;
 
-       refspec_item_init(&spec, refspec, REFSPEC_FETCH);
+       refspec_item_init_or_die(&spec, refspec, REFSPEC_FETCH);
        spec_src = spec.src;
        if (!*spec_src || !strcmp(spec_src, "HEAD"))
                spec_src = "HEAD";
index ada7854f7a6a55a783cf90574e1d759f5c3a661f..54b6fe0c6d7372d5fc27c04e0d6e93761ba68250 100644 (file)
--- a/refspec.c
+++ b/refspec.c
@@ -122,7 +122,8 @@ static int parse_refspec(struct refspec_item *item, const char *refspec, int fet
        return 1;
 }
 
-void refspec_item_init(struct refspec_item *item, const char *refspec, int fetch)
+void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
+                             int fetch)
 {
        memset(item, 0, sizeof(*item));
 
@@ -150,7 +151,7 @@ void refspec_append(struct refspec *rs, const char *refspec)
 {
        struct refspec_item item;
 
-       refspec_item_init(&item, refspec, rs->fetch);
+       refspec_item_init_or_die(&item, refspec, rs->fetch);
 
        ALLOC_GROW(rs->items, rs->nr + 1, rs->alloc);
        rs->items[rs->nr++] = item;
index 3a9363887c48dbba612ae4de195c30f9d382c00c..4caaf1f8e3b79a9b68beca5f841dbfc487d154a2 100644 (file)
--- a/refspec.h
+++ b/refspec.h
@@ -32,7 +32,8 @@ struct refspec {
        int fetch;
 };
 
-void refspec_item_init(struct refspec_item *item, const char *refspec, int fetch);
+void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
+                             int fetch);
 void refspec_item_clear(struct refspec_item *item);
 void refspec_init(struct refspec *rs, int fetch);
 void refspec_append(struct refspec *rs, const char *refspec);