From: Junio C Hamano Date: Mon, 30 Sep 2019 04:19:27 +0000 (+0900) Subject: Merge branch 'rs/help-unknown-ref-does-not-return' X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8e111e487bbb939406655619e7ed241bd263d85c?ds=inline;hp=-c Merge branch 'rs/help-unknown-ref-does-not-return' Code cleanup. * rs/help-unknown-ref-does-not-return: help: make help_unknown_ref() NORETURN --- 8e111e487bbb939406655619e7ed241bd263d85c diff --combined help.c index 5261d83ecf,5231c919c7..9ff2be6b18 --- a/help.c +++ b/help.c @@@ -754,19 -754,19 +754,19 @@@ static int append_similar_ref(const cha { struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data); char *branch = strrchr(refname, '/') + 1; - const char *remote; /* A remote branch of the same name is deemed similar */ - if (skip_prefix(refname, "refs/remotes/", &remote) && + if (starts_with(refname, "refs/remotes/") && !strcmp(branch, cb->base_ref)) - string_list_append(cb->similar_refs, remote); + string_list_append_nodup(cb->similar_refs, + shorten_unambiguous_ref(refname, 1)); return 0; } static struct string_list guess_refs(const char *ref) { struct similar_ref_cb ref_cb; - struct string_list similar_refs = STRING_LIST_INIT_NODUP; + struct string_list similar_refs = STRING_LIST_INIT_DUP; ref_cb.base_ref = ref; ref_cb.similar_refs = &similar_refs; @@@ -774,7 -774,8 +774,8 @@@ return similar_refs; } - void help_unknown_ref(const char *ref, const char *cmd, const char *error) + NORETURN void help_unknown_ref(const char *ref, const char *cmd, + const char *error) { int i; struct string_list suggested_refs = guess_refs(ref);