Merge branch 'cl/config-regexp-docfix' into maint-2.46
[git/gitster.git] / t / t9828-git-p4-map-user.sh
blob7c8f9e3930406de82e80817a25a0bd9eb9324fbf
1 #!/bin/sh
3 test_description='Clone repositories and map users'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./lib-git-p4.sh
8 test_expect_success 'start p4d' '
9 start_p4d
12 test_expect_success 'Create a repo with different users' '
13 client_view "//depot/... //client/..." &&
15 cd "$cli" &&
17 >author.txt &&
18 p4 add author.txt &&
19 p4 submit -d "Add file author\\n" &&
21 P4USER=mmax &&
22 >max.txt &&
23 p4 add max.txt &&
24 p4 submit -d "Add file max" &&
26 P4USER=eri &&
27 >moritz.txt &&
28 p4 add moritz.txt &&
29 p4 submit -d "Add file moritz" &&
31 P4USER=no &&
32 >nobody.txt &&
33 p4 add nobody.txt &&
34 p4 submit -d "Add file nobody"
38 test_expect_success 'Clone repo root path with all history' '
39 client_view "//depot/... //client/..." &&
40 test_when_finished cleanup_git &&
42 cd "$git" &&
43 git init . &&
44 git config --add git-p4.mapUser "mmax = Max Musterman <max@example.com> " &&
45 git config --add git-p4.mapUser " eri=Erika Musterman <erika@example.com>" &&
46 git p4 clone --use-client-spec --destination="$git" //depot@all &&
47 cat >expect <<-\EOF &&
48 no <no@client>
49 Erika Musterman <erika@example.com>
50 Max Musterman <max@example.com>
51 Dr. author <author@example.com>
52 EOF
53 git log --format="%an <%ae>" >actual &&
54 test_cmp expect actual
58 test_done