summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-06-13 13:19:42 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-06-13 13:19:42 -0700
commit8d32d2552ee476917d216ae584d3d9b9002844d3 (patch)
tree69f724aff5540a3f604364da1dc32a67c7b02a04 /t
parentMerge branch 'dl/format-patch-notes-config' (diff)
parenthelp_unknown_ref(): check for refname ambiguity (diff)
downloadtgif-8d32d2552ee476917d216ae584d3d9b9002844d3.tar.xz
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 't')
-rwxr-xr-xt/t7600-merge.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 3e16aaed3b..612ebe7d82 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -893,4 +893,24 @@ test_expect_success 'merge --quit' '
)
'
+test_expect_success 'merge suggests matching remote refname' '
+ git commit --allow-empty -m not-local &&
+ git update-ref refs/remotes/origin/not-local HEAD &&
+ git reset --hard HEAD^ &&
+
+ # This is white-box testing hackery; we happen to know
+ # that reading packed refs is more picky about the memory
+ # ownership of strings we pass to for_each_ref() callbacks.
+ git pack-refs --all --prune &&
+
+ test_must_fail git merge not-local 2>stderr &&
+ grep origin/not-local stderr
+'
+
+test_expect_success 'suggested names are not ambiguous' '
+ git update-ref refs/heads/origin/not-local HEAD &&
+ test_must_fail git merge not-local 2>stderr &&
+ grep remotes/origin/not-local stderr
+'
+
test_done