From e860d96bf89fca63f664eb2d507f2f14537a9008 Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Wed, 22 Feb 2017 11:01:22 -0500 Subject: fetch-pack: move code to report unmatched refs to a function Prepare to reuse this code in transport.c for "git fetch". While we're here, internationalize the existing error message. Signed-off-by: Matt McCutchen Signed-off-by: Junio C Hamano --- fetch-pack.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'fetch-pack.c') diff --git a/fetch-pack.c b/fetch-pack.c index 601f0779a1..7c8d44c38b 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1094,3 +1094,16 @@ struct ref *fetch_pack(struct fetch_pack_args *args, clear_shallow_info(&si); return ref_cpy; } + +int report_unmatched_refs(struct ref **sought, int nr_sought) +{ + int i, ret = 0; + + for (i = 0; i < nr_sought; i++) { + if (!sought[i] || sought[i]->matched) + continue; + error(_("no such remote ref %s"), sought[i]->name); + ret = 1; + } + return ret; +} -- cgit v1.2.1