t / t1514-rev-parse-push.shon commit Merge branch 'bn/http-cookiefile-config' (459000e)
   1#!/bin/sh
   2
   3test_description='test <branch>@{push} syntax'
   4. ./test-lib.sh
   5
   6resolve () {
   7        echo "$2" >expect &&
   8        git rev-parse --symbolic-full-name "$1" >actual &&
   9        test_cmp expect actual
  10}
  11
  12test_expect_success 'setup' '
  13        git init --bare parent.git &&
  14        git init --bare other.git &&
  15        git remote add origin parent.git &&
  16        git remote add other other.git &&
  17        test_commit base &&
  18        git push origin HEAD &&
  19        git branch --set-upstream-to=origin/master master &&
  20        git branch --track topic origin/master &&
  21        git push origin topic &&
  22        git push other topic
  23'
  24
  25test_expect_success '@{push} with default=nothing' '
  26        test_config push.default nothing &&
  27        test_must_fail git rev-parse master@{push}
  28'
  29
  30test_expect_success '@{push} with default=simple' '
  31        test_config push.default simple &&
  32        resolve master@{push} refs/remotes/origin/master
  33'
  34
  35test_expect_success 'triangular @{push} fails with default=simple' '
  36        test_config push.default simple &&
  37        test_must_fail git rev-parse topic@{push}
  38'
  39
  40test_expect_success '@{push} with default=current' '
  41        test_config push.default current &&
  42        resolve topic@{push} refs/remotes/origin/topic
  43'
  44
  45test_expect_success '@{push} with default=matching' '
  46        test_config push.default matching &&
  47        resolve topic@{push} refs/remotes/origin/topic
  48'
  49
  50test_expect_success '@{push} with pushremote defined' '
  51        test_config push.default current &&
  52        test_config branch.topic.pushremote other &&
  53        resolve topic@{push} refs/remotes/other/topic
  54'
  55
  56test_expect_success '@{push} with push refspecs' '
  57        test_config push.default nothing &&
  58        test_config remote.origin.push refs/heads/*:refs/heads/magic/* &&
  59        git push &&
  60        resolve topic@{push} refs/remotes/origin/magic/topic
  61'
  62
  63test_done