summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-06-13 20:19:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-13 20:19:42 (GMT)
commit8d32d2552ee476917d216ae584d3d9b9002844d3 (patch)
tree69f724aff5540a3f604364da1dc32a67c7b02a04 /help.c
parente91f65d0e28b9f4dce85f82c5e3e208a54171a14 (diff)
parent2ed2e19958f2bcf59cac18a69b27f74ba7079a2f (diff)
downloadgit-8d32d2552ee476917d216ae584d3d9b9002844d3.zip
git-8d32d2552ee476917d216ae584d3d9b9002844d3.tar.gz
git-8d32d2552ee476917d216ae584d3d9b9002844d3.tar.bz2
Merge branch 'jk/help-unknown-ref-fix'
Improve the code to show args with potential typo that cannot be interpreted as a commit-ish. * jk/help-unknown-ref-fix: help_unknown_ref(): check for refname ambiguity help_unknown_ref(): duplicate collected refnames
Diffstat (limited to 'help.c')
-rw-r--r--help.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/help.c b/help.c
index a9e451f..5261d83 100644
--- a/help.c
+++ b/help.c
@@ -754,19 +754,19 @@ static int append_similar_ref(const char *refname, const struct object_id *oid,
{
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;