t/t5505-remote: test url-with-# in branches-file
Add one more test similar to "migrate a remote from named file in $GIT_DIR/branches" to check that a url with a # can be used to specify the branch name (as opposed to the constant "master"). Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Jun 22, 2013 at 13:28 UTC
1f9a5e905e56502097eb9097a6ea2e9b9cb2e168
1 file changed
+18
-4
t/t5505-remote.sh
+18
-4
@@ -769,27 +769,41 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
769
)
770
'
771
772
-test_expect_success 'remote prune to cause a dangling symref' '
772
+test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)' '
773
git clone one seven &&
774
+ (
775
+ cd seven &&
776
+ git remote rm origin &&
777
+ echo "quux#foom" > .git/branches/origin &&
778
+ git remote rename origin origin &&
779
+ test_path_is_missing .git/branches/origin &&
780
+ test "$(git config remote.origin.url)" = "quux" &&
781
+ test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"
782
+ test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
783
+ )
784
+'
785
+
786
+test_expect_success 'remote prune to cause a dangling symref' '
787
+ git clone one eight &&
788
(
789
cd one &&
790
git checkout side2 &&
791
git branch -D master
792
) &&
793
(
780
- cd seven &&
794
+ cd eight &&
795
git remote prune origin
796
) >err 2>&1 &&
797
test_i18ngrep "has become dangling" err &&
798
799
: And the dangling symref will not cause other annoying errors &&
800
(
787
- cd seven &&
801
+ cd eight &&
802
git branch -a
803
) 2>err &&
804
! grep "points nowhere" err &&
805
(
792
- cd seven &&
806
+ cd eight &&
807
test_must_fail git branch nomore origin
808
) 2>err &&
809
grep "dangling symref" err