t / t5529-push-errors.shon commit Merge branch 'rs/path-name-safety-cleanup' (3bf7d37)
   1#!/bin/sh
   2
   3test_description='detect some push errors early (before contacting remote)'
   4. ./test-lib.sh
   5
   6test_expect_success 'setup commits' '
   7        test_commit one
   8'
   9
  10test_expect_success 'setup remote' '
  11        git init --bare remote.git &&
  12        git remote add origin remote.git
  13'
  14
  15test_expect_success 'setup fake receive-pack' '
  16        FAKE_RP_ROOT=$(pwd) &&
  17        export FAKE_RP_ROOT &&
  18        write_script fake-rp <<-\EOF &&
  19        echo yes >"$FAKE_RP_ROOT"/rp-ran
  20        exit 1
  21        EOF
  22        git config remote.origin.receivepack "\"\$FAKE_RP_ROOT/fake-rp\""
  23'
  24
  25test_expect_success 'detect missing branches early' '
  26        echo no >rp-ran &&
  27        echo no >expect &&
  28        test_must_fail git push origin missing &&
  29        test_cmp expect rp-ran
  30'
  31
  32test_expect_success 'detect missing sha1 expressions early' '
  33        echo no >rp-ran &&
  34        echo no >expect &&
  35        test_must_fail git push origin master~2:master &&
  36        test_cmp expect rp-ran
  37'
  38
  39test_expect_success 'detect ambiguous refs early' '
  40        git branch foo &&
  41        git tag foo &&
  42        echo no >rp-ran &&
  43        echo no >expect &&
  44        test_must_fail git push origin foo &&
  45        test_cmp expect rp-ran
  46'
  47
  48test_done