3 test_description
='git remote porcelain-ish'
13 git commit
-m "Initial" &&
14 git checkout
-b side
&&
17 git commit
-m "Second" &&
23 echo "$1" |
tr ' ' '\012' |
sort |
sed -e '/^$/d' >expect
&&
24 echo "$2" |
tr ' ' '\012' |
sort |
sed -e '/^$/d' >actual
&&
28 check_remote_track
() {
29 actual
=$
(git remote show
"$1" |
sed -n -e '$p') &&
31 tokens_match
"$*" "$actual"
34 check_tracking_branch
() {
36 r
=$
(git for-each-ref
"--format=%(refname)" |
37 sed -ne "s|^refs/remotes/$1/||p") &&
39 tokens_match
"$*" "$r"
42 test_expect_success setup
'
44 setup_repository one &&
45 setup_repository two &&
47 cd two && git branch another
53 test_expect_success
'remote information for the origin' '
56 tokens_match origin "$(git remote)" &&
57 check_remote_track origin master side &&
58 check_tracking_branch origin HEAD master side
62 test_expect_success
'add another remote' '
65 git remote add -f second ../two &&
66 tokens_match "origin second" "$(git remote)" &&
67 check_remote_track origin master side &&
68 check_remote_track second master side another &&
69 check_tracking_branch second master side another &&
70 git for-each-ref "--format=%(refname)" refs/remotes |
71 sed -e "/^refs\/remotes\/origin\//d" \
72 -e "/^refs\/remotes\/second\//d" >actual &&
78 test_expect_success
'remove remote' '
85 test_expect_success
'remove remote' '
88 tokens_match origin "$(git remote)" &&
89 check_remote_track origin master side &&
90 git for-each-ref "--format=%(refname)" refs/remotes |
91 sed -e "/^refs\/remotes\/origin\//d" >actual &&
97 cat > test
/expect
<< EOF
100 Remote branch merged with 'git pull' while on branch master
102 New remote branch (next fetch will store in remotes/origin)
104 Tracked remote branches
108 test_expect_success
'show' '
110 git config --add remote.origin.fetch \
111 refs/heads/master:refs/heads/upstream &&
113 git branch -d -r origin/master &&
116 git commit -m update file) &&
117 git remote show origin > output &&
118 git diff expect output)
121 test_expect_success
'prune' '
123 git branch -m side side2) &&
126 git remote prune origin &&
127 git rev-parse refs/remotes/origin/side2 &&
128 ! git rev-parse refs/remotes/origin/side)
131 test_expect_success
'add --mirror && prune' '
135 git remote add --mirror -f origin ../one) &&
137 git branch -m side2 side) &&
139 git rev-parse --verify refs/heads/side2 &&
140 ! git rev-parse --verify refs/heads/side &&
142 git remote prune origin &&
143 ! git rev-parse --verify refs/heads/side2 &&
144 git rev-parse --verify refs/heads/side)