]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3200-branch.sh
branch: quote branch/ref names to improve readability
[thirdparty/git.git] / t / t3200-branch.sh
index 48d152b9a9519e00227a0877631d643ecf38e687..51738fb96943bbc475d0f71ba77e4786dd0aea11 100755 (executable)
@@ -162,6 +162,16 @@ test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD'
        grep "^0\{40\}.*$msg$" .git/logs/HEAD
 '
 
+test_expect_success 'resulting reflog can be shown by log -g' '
+       oid=$(git rev-parse HEAD) &&
+       cat >expect <<-EOF &&
+       HEAD@{0} $oid $msg
+       HEAD@{2} $oid checkout: moving from foo to baz
+       EOF
+       git log -g --format="%gd %H %gs" -2 HEAD >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' '
        git checkout master &&
        git worktree add -b baz bazdir &&
@@ -549,6 +559,7 @@ test_expect_success 'use --set-upstream-to modify HEAD' '
 test_expect_success 'use --set-upstream-to modify a particular branch' '
        git branch my13 &&
        git branch --set-upstream-to master my13 &&
+       test_when_finished "git branch --unset-upstream my13" &&
        test "$(git config branch.my13.remote)" = "." &&
        test "$(git config branch.my13.merge)" = "refs/heads/master"
 '
@@ -594,38 +605,8 @@ test_expect_success 'test --unset-upstream on a particular branch' '
        test_must_fail git config branch.my14.merge
 '
 
-test_expect_success '--set-upstream shows message when creating a new branch that exists as remote-tracking' '
-       git update-ref refs/remotes/origin/master HEAD &&
-       git branch --set-upstream origin/master 2>actual &&
-       test_when_finished git update-ref -d refs/remotes/origin/master &&
-       test_when_finished git branch -d origin/master &&
-       cat >expected <<EOF &&
-The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
-
-If you wanted to make '"'master'"' track '"'origin/master'"', do this:
-
-    git branch -d origin/master
-    git branch --set-upstream-to origin/master
-EOF
-       test_i18ncmp expected actual
-'
-
-test_expect_success '--set-upstream with two args only shows the deprecation message' '
-       git branch --set-upstream master my13 2>actual &&
-       test_when_finished git branch --unset-upstream master &&
-       cat >expected <<EOF &&
-The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
-EOF
-       test_i18ncmp expected actual
-'
-
-test_expect_success '--set-upstream with one arg only shows the deprecation message if the branch existed' '
-       git branch --set-upstream my13 2>actual &&
-       test_when_finished git branch --unset-upstream my13 &&
-       cat >expected <<EOF &&
-The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
-EOF
-       test_i18ncmp expected actual
+test_expect_success '--set-upstream fails' '
+    test_must_fail git branch --set-upstream origin/master
 '
 
 test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
@@ -950,19 +931,6 @@ test_expect_success 'attempt to delete a branch merged to its base' '
        test_must_fail git branch -d my10
 '
 
-test_expect_success 'use set-upstream on the current branch' '
-       git checkout master &&
-       git --bare init myupstream.git &&
-       git push myupstream.git master:refs/heads/frotz &&
-       git remote add origin myupstream.git &&
-       git fetch &&
-       git branch --set-upstream master origin/frotz &&
-
-       test "z$(git config branch.master.remote)" = "zorigin" &&
-       test "z$(git config branch.master.merge)" = "zrefs/heads/frotz"
-
-'
-
 test_expect_success 'use --edit-description' '
        write_script editor <<-\EOF &&
                echo "New contents" >"$1"