From: Junio C Hamano Date: Thu, 13 Jun 2019 20:19:42 +0000 (-0700) Subject: Merge branch 'jk/help-unknown-ref-fix' X-Git-Tag: v2.23.0-rc0~132 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8d32d2552ee476917d216ae584d3d9b9002844d3 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 --- 8d32d2552ee476917d216ae584d3d9b9002844d3 diff --cc t/t7600-merge.sh index 3e16aaed3b,36b2c8c91f..612ebe7d82 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@@ -867,30 -822,24 +867,50 @@@ test_expect_success EXECKEEPSPID 'kille verify_parents $c0 $c1 ' +test_expect_success 'merge --quit' ' + git init merge-quit && + ( + cd merge-quit && + test_commit base && + echo one >>base.t && + git commit -am one && + git branch one && + git checkout base && + echo two >>base.t && + git commit -am two && + test_must_fail git -c rerere.enabled=true merge one && + test_path_is_file .git/MERGE_HEAD && + test_path_is_file .git/MERGE_MODE && + test_path_is_file .git/MERGE_MSG && + git rerere status >rerere.before && + git merge --quit && + test_path_is_missing .git/MERGE_HEAD && + test_path_is_missing .git/MERGE_MODE && + test_path_is_missing .git/MERGE_MSG && + git rerere status >rerere.after && + test_must_be_empty rerere.after && + ! test_cmp rerere.after rerere.before + ) +' + + 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