status: refactor null_termination option
[gitweb.git] / t / t5510-fetch.sh
index 9d72b16393e3cbee30d16519ae641e84d7485f39..d7a19a182941c7ab54b81bb8013835cfb8c5919f 100755 (executable)
@@ -78,8 +78,8 @@ test_expect_success "fetch test for-merge" '
        master_in_two=`cd ../two && git rev-parse master` &&
        one_in_two=`cd ../two && git rev-parse one` &&
        {
-               echo "$master_in_two    not-for-merge"
                echo "$one_in_two       "
+               echo "$master_in_two    not-for-merge"
        } >expected &&
        cut -f -2 .git/FETCH_HEAD >actual &&
        test_cmp expected actual'
@@ -162,6 +162,36 @@ test_expect_success 'fetch following tags' '
 
 '
 
+test_expect_success 'fetch uses remote ref names to describe new refs' '
+       cd "$D" &&
+       git init descriptive &&
+       (
+               cd descriptive &&
+               git config remote.o.url .. &&
+               git config remote.o.fetch "refs/heads/*:refs/crazyheads/*" &&
+               git config --add remote.o.fetch "refs/others/*:refs/heads/*" &&
+               git fetch o
+       ) &&
+       git tag -a -m "Descriptive tag" descriptive-tag &&
+       git branch descriptive-branch &&
+       git checkout descriptive-branch &&
+       echo "Nuts" >crazy &&
+       git add crazy &&
+       git commit -a -m "descriptive commit" &&
+       git update-ref refs/others/crazy HEAD &&
+       (
+               cd descriptive &&
+               git fetch o 2>actual &&
+               grep " -> refs/crazyheads/descriptive-branch$" actual |
+               test_i18ngrep "new branch" &&
+               grep " -> descriptive-tag$" actual |
+               test_i18ngrep "new tag" &&
+               grep " -> crazy$" actual |
+               test_i18ngrep "new ref"
+       ) &&
+       git checkout master
+'
+
 test_expect_success 'fetch must not resolve short tag name' '
 
        cd "$D" &&
@@ -174,7 +204,7 @@ test_expect_success 'fetch must not resolve short tag name' '
 
 '
 
-test_expect_success 'fetch must not resolve short remote name' '
+test_expect_success 'fetch can now resolve short remote name' '
 
        cd "$D" &&
        git update-ref refs/remotes/six/HEAD HEAD &&
@@ -183,8 +213,7 @@ test_expect_success 'fetch must not resolve short remote name' '
        cd six &&
        git init &&
 
-       test_must_fail git fetch .. six:six
-
+       git fetch .. six:six
 '
 
 test_expect_success 'create bundle 1' '