cat > test/expect << EOF
* remote origin
- URL: $(pwd)/one/.git
+ URL: $(pwd)/one
Remote branch merged with 'git pull' while on branch master
master
New remote branch (next fetch will store in remotes/origin)
test_cmp expect output)
'
+cat > test/expect << EOF
+* remote origin
+ URL: $(pwd)/one
+ Remote branch merged with 'git pull' while on branch master
+ master
+ Tracked remote branches
+ master side
+ Local branches pushed with 'git push'
+ master:upstream +refs/tags/lastbackup
+EOF
+
+test_expect_success 'show -n' '
+ (mv one one.unreachable &&
+ cd test &&
+ git remote show -n origin > output &&
+ mv ../one.unreachable ../one &&
+ test_cmp expect output)
+'
+
test_expect_success 'prune' '
(cd one &&
git branch -m side side2) &&
git fetch origin &&
git remote prune origin &&
git rev-parse refs/remotes/origin/side2 &&
- ! git rev-parse refs/remotes/origin/side)
+ test_must_fail git rev-parse refs/remotes/origin/side)
+'
+
+cat > test/expect << EOF
+Pruning origin
+URL: $(pwd)/one
+ * [would prune] origin/side2
+EOF
+
+test_expect_success 'prune --dry-run' '
+ (cd one &&
+ git branch -m side2 side) &&
+ (cd test &&
+ git remote prune --dry-run origin > output &&
+ git rev-parse refs/remotes/origin/side2 &&
+ test_must_fail git rev-parse refs/remotes/origin/side &&
+ (cd ../one &&
+ git branch -m side side2) &&
+ test_cmp expect output)
'
test_expect_success 'add --mirror && prune' '
git branch -m side2 side) &&
(cd mirror &&
git rev-parse --verify refs/heads/side2 &&
- ! git rev-parse --verify refs/heads/side &&
+ test_must_fail git rev-parse --verify refs/heads/side &&
git fetch origin &&
git remote prune origin &&
- ! git rev-parse --verify refs/heads/side2 &&
+ test_must_fail git rev-parse --verify refs/heads/side2 &&
git rev-parse --verify refs/heads/side)
'
+test_expect_success 'add alt && prune' '
+ (mkdir alttst &&
+ cd alttst &&
+ git init &&
+ git remote add -f origin ../one &&
+ git config remote.alt.url ../one &&
+ git config remote.alt.fetch "+refs/heads/*:refs/remotes/origin/*") &&
+ (cd one &&
+ git branch -m side side2) &&
+ (cd alttst &&
+ git rev-parse --verify refs/remotes/origin/side &&
+ test_must_fail git rev-parse --verify refs/remotes/origin/side2 &&
+ git fetch alt &&
+ git remote prune alt &&
+ test_must_fail git rev-parse --verify refs/remotes/origin/side &&
+ git rev-parse --verify refs/remotes/origin/side2)
+'
+
cat > one/expect << EOF
apis/master
apis/side
test_expect_success 'reject adding remote with an invalid name' '
- ! git remote add some:url desired-name
+ test_must_fail git remote add some:url desired-name
'