diff options
| author | Taylor Blau <me@ttaylorr.com> | 2025-03-18 18:50:24 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-03-21 01:45:16 -0700 |
| commit | ec6829e4849feb7b0343940e00896055027b06eb (patch) | |
| tree | 32fa01704f114a697f95c40abd6a029575ad8ad1 /builtin/pull.c | |
| parent | 0baad1f3aee508d84bf74b9670f283f8c91e55dd (diff) | |
| download | git-ec6829e4849feb7b0343940e00896055027b06eb.tar.gz | |
refspec: remove refspec_item_init_or_die()
There are two callers of this function, which ensures that a dispatched
call to refspec_item_init() does not fail.
In the following commit, we're going to add fetch/push-specific variants
of refspec_item_init(), which will turn one function into two. To avoid
introducing yet another pair of new functions (such as
refspec_item_init_push_or_die() and refspec_item_init_fetch_or_die()),
let's remove the thin wrapper entirely.
This duplicates a single line of code among two callers, but thins the
refspec.h API by one function, and prevents introducing two more in the
following commit.
Note that we still have a trailing Boolean argument in the function
`refspec_item_init()`. The following commit will address this.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pull.c')
| -rw-r--r-- | builtin/pull.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/pull.c b/builtin/pull.c index 8bbfcce729..a68a9955de 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -738,7 +738,8 @@ static const char *get_tracking_branch(const char *remote, const char *refspec) const char *spec_src; const char *merge_branch; - refspec_item_init_or_die(&spec, refspec, 1); + if (!refspec_item_init(&spec, refspec, 1)) + die(_("invalid refspec '%s'"), refspec); spec_src = spec.src; if (!*spec_src || !strcmp(spec_src, "HEAD")) spec_src = "HEAD"; |
