t / t5410-receive-pack-alternates.shon commit l10n: sv.po: Update Swedish translation (4185t0f0u) (4a81e9c)
   1#!/bin/sh
   2
   3test_description='git receive-pack with alternate ref filtering'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'setup' '
   8        test_commit base &&
   9        git clone -s --bare . fork &&
  10        git checkout -b public/branch master &&
  11        test_commit public &&
  12        git checkout -b private/branch master &&
  13        test_commit private
  14'
  15
  16extract_haves () {
  17        depacketize | perl -lne '/^(\S+) \.have/ and print $1'
  18}
  19
  20test_expect_success 'with core.alternateRefsCommand' '
  21        write_script fork/alternate-refs <<-\EOF &&
  22                git --git-dir="$1" for-each-ref \
  23                        --format="%(objectname)" \
  24                        refs/heads/public/
  25        EOF
  26        test_config -C fork core.alternateRefsCommand ./alternate-refs &&
  27        git rev-parse public/branch >expect &&
  28        printf "0000" | git receive-pack fork >actual &&
  29        extract_haves <actual >actual.haves &&
  30        test_cmp expect actual.haves
  31'
  32
  33test_expect_success 'with core.alternateRefsPrefixes' '
  34        test_config -C fork core.alternateRefsPrefixes "refs/heads/private" &&
  35        git rev-parse private/branch >expect &&
  36        printf "0000" | git receive-pack fork >actual &&
  37        extract_haves <actual >actual.haves &&
  38        test_cmp expect actual.haves
  39'
  40
  41test_done