t5516: more tests for receive.denyCurrentBranch=updateInstead
[gitweb.git] / t / t1410-reflog.sh
index 8cab06f90a52b82518aca6f7baa0530eb77ab986..976c1d4277ba902cd5b592c9bcbf72c7b9111cd3 100755 (executable)
@@ -253,4 +253,38 @@ test_expect_success 'checkout should not delete log for packed ref' '
        test $(git reflog master | wc -l) = 4
 '
 
+test_expect_success 'stale dirs do not cause d/f conflicts (reflogs on)' '
+       test_when_finished "git branch -d a || git branch -d a/b" &&
+
+       git branch a/b master &&
+       echo "a/b@{0} branch: Created from master" >expect &&
+       git log -g --format="%gd %gs" a/b >actual &&
+       test_cmp expect actual &&
+       git branch -d a/b &&
+
+       # now logs/refs/heads/a is a stale directory, but
+       # we should move it out of the way to create "a" reflog
+       git branch a master &&
+       echo "a@{0} branch: Created from master" >expect &&
+       git log -g --format="%gd %gs" a >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
+       test_when_finished "git branch -d a || git branch -d a/b" &&
+
+       git branch a/b master &&
+       echo "a/b@{0} branch: Created from master" >expect &&
+       git log -g --format="%gd %gs" a/b >actual &&
+       test_cmp expect actual &&
+       git branch -d a/b &&
+
+       # same as before, but we only create a reflog for "a" if
+       # it already exists, which it does not
+       git -c core.logallrefupdates=false branch a master &&
+       : >expect &&
+       git log -g --format="%gd %gs" a >actual &&
+       test_cmp expect actual
+'
+
 test_done