Merge branch 'om/remote-fix'

* om/remote-fix:
  "remote prune": be quiet when there is nothing to prune
  remote show: list tracked remote branches with -n
  remote prune: print the list of pruned branches
  builtin-remote: split show_or_prune() in two separate functions
  remote show: fix the -n option
This commit is contained in:
Junio C Hamano
2008-06-12 22:55:44 -07:00
3 changed files with 153 additions and 51 deletions

View File

@@ -138,6 +138,25 @@ test_expect_success 'show' '
test_cmp expect output)
'
cat > test/expect << EOF
* remote origin
URL: $(pwd)/one/.git
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) &&
@@ -148,6 +167,24 @@ test_expect_success 'prune' '
! git rev-parse refs/remotes/origin/side)
'
cat > test/expect << EOF
Pruning origin
URL: $(pwd)/one/.git
* [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 &&
! git rev-parse refs/remotes/origin/side &&
(cd ../one &&
git branch -m side side2) &&
test_cmp expect output)
'
test_expect_success 'add --mirror && prune' '
(mkdir mirror &&
cd mirror &&