t / t5521-pull-options.shon commit remote-testgit: properly check for errors (6c32332)
   1#!/bin/sh
   2
   3test_description='pull options'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'setup' '
   8        mkdir parent &&
   9        (cd parent && git init &&
  10         echo one >file && git add file &&
  11         git commit -m one)
  12'
  13
  14test_expect_success 'git pull -q' '
  15        mkdir clonedq &&
  16        (cd clonedq && git init &&
  17        git pull -q "../parent" >out 2>err &&
  18        test ! -s err &&
  19        test ! -s out)
  20'
  21
  22test_expect_success 'git pull' '
  23        mkdir cloned &&
  24        (cd cloned && git init &&
  25        git pull "../parent" >out 2>err &&
  26        test -s err &&
  27        test ! -s out)
  28'
  29
  30test_expect_success 'git pull -v' '
  31        mkdir clonedv &&
  32        (cd clonedv && git init &&
  33        git pull -v "../parent" >out 2>err &&
  34        test -s err &&
  35        test ! -s out)
  36'
  37
  38test_expect_success 'git pull -v -q' '
  39        mkdir clonedvq &&
  40        (cd clonedvq && git init &&
  41        git pull -v -q "../parent" >out 2>err &&
  42        test ! -s out &&
  43        test ! -s err)
  44'
  45
  46test_expect_success 'git pull -q -v' '
  47        mkdir clonedqv &&
  48        (cd clonedqv && git init &&
  49        git pull -q -v "../parent" >out 2>err &&
  50        test ! -s out &&
  51        test -s err)
  52'
  53
  54test_expect_success 'git pull --force' '
  55        mkdir clonedoldstyle &&
  56        (cd clonedoldstyle && git init &&
  57        cat >>.git/config <<-\EOF &&
  58        [remote "one"]
  59                url = ../parent
  60                fetch = refs/heads/master:refs/heads/mirror
  61        [remote "two"]
  62                url = ../parent
  63                fetch = refs/heads/master:refs/heads/origin
  64        [branch "master"]
  65                remote = two
  66                merge = refs/heads/master
  67        EOF
  68        git pull two &&
  69        test_commit A &&
  70        git branch -f origin &&
  71        git pull --all --force
  72        )
  73'
  74
  75test_expect_success 'git pull --all' '
  76        mkdir clonedmulti &&
  77        (cd clonedmulti && git init &&
  78        cat >>.git/config <<-\EOF &&
  79        [remote "one"]
  80                url = ../parent
  81                fetch = refs/heads/*:refs/remotes/one/*
  82        [remote "two"]
  83                url = ../parent
  84                fetch = refs/heads/*:refs/remotes/two/*
  85        [branch "master"]
  86                remote = one
  87                merge = refs/heads/master
  88        EOF
  89        git pull --all
  90        )
  91'
  92
  93test_done