t / t9828-git-p4-map-user.shon commit Merge branch 'en/merge-fixes' (10b8084)
   1#!/bin/sh
   2
   3test_description='Clone repositories and map users'
   4
   5. ./lib-git-p4.sh
   6
   7test_expect_success 'start p4d' '
   8        start_p4d
   9'
  10
  11test_expect_success 'Create a repo with different users' '
  12        client_view "//depot/... //client/..." &&
  13        (
  14                cd "$cli" &&
  15
  16                >author.txt &&
  17                p4 add author.txt &&
  18                p4 submit -d "Add file author\\n" &&
  19
  20                P4USER=mmax &&
  21                >max.txt &&
  22                p4 add max.txt &&
  23                p4 submit -d "Add file max" &&
  24
  25                P4USER=eri &&
  26                >moritz.txt &&
  27                p4 add moritz.txt &&
  28                p4 submit -d "Add file moritz" &&
  29
  30                P4USER=no &&
  31                >nobody.txt &&
  32                p4 add nobody.txt &&
  33                p4 submit -d "Add file nobody"
  34        )
  35'
  36
  37test_expect_success 'Clone repo root path with all history' '
  38        client_view "//depot/... //client/..." &&
  39        test_when_finished cleanup_git &&
  40        (
  41                cd "$git" &&
  42                git init . &&
  43                git config --add git-p4.mapUser "mmax = Max Musterman   <max@example.com> "  &&
  44                git config --add git-p4.mapUser "  eri=Erika Musterman <erika@example.com>" &&
  45                git p4 clone --use-client-spec --destination="$git" //depot@all &&
  46                cat >expect <<-\EOF &&
  47                        no <no@client>
  48                        Erika Musterman <erika@example.com>
  49                        Max Musterman <max@example.com>
  50                        Dr. author <author@example.com>
  51                EOF
  52                git log --format="%an <%ae>" >actual &&
  53                test_cmp expect actual
  54        )
  55'
  56
  57test_expect_success 'kill p4d' '
  58        kill_p4d
  59'
  60
  61test_done