t / t9822-git-p4-path-encoding.shon commit Merge branch 'sg/core-filemode-doc-typofix' into maint (b8a4652)
   1#!/bin/sh
   2
   3test_description='Clone repositories with non ASCII paths'
   4
   5. ./lib-git-p4.sh
   6
   7UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
   8ISO8859_ESCAPED="a-\344_o-\366_u-\374.txt"
   9
  10test_expect_success 'start p4d' '
  11        start_p4d
  12'
  13
  14test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
  15        (
  16                cd "$cli" &&
  17                ISO8859="$(printf "$ISO8859_ESCAPED")" &&
  18                echo content123 >"$ISO8859" &&
  19                p4 add "$ISO8859" &&
  20                p4 submit -d "test commit"
  21        )
  22'
  23
  24test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' '
  25        git p4 clone --destination="$git" //depot &&
  26        test_when_finished cleanup_git &&
  27        (
  28                cd "$git" &&
  29                UTF8="$(printf "$UTF8_ESCAPED")" &&
  30                echo "$UTF8" >expect &&
  31                git -c core.quotepath=false ls-files >actual &&
  32                test_cmp expect actual
  33        )
  34'
  35
  36test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
  37        test_when_finished cleanup_git &&
  38        (
  39                cd "$git" &&
  40                git init . &&
  41                git config git-p4.pathEncoding iso8859-1 &&
  42                git p4 clone --use-client-spec --destination="$git" //depot &&
  43                UTF8="$(printf "$UTF8_ESCAPED")" &&
  44                echo "$UTF8" >expect &&
  45                git -c core.quotepath=false ls-files >actual &&
  46                test_cmp expect actual &&
  47
  48                echo content123 >expect &&
  49                cat "$UTF8" >actual &&
  50                test_cmp expect actual
  51        )
  52'
  53
  54test_expect_success 'Delete iso8859-1 encoded paths and clone' '
  55        (
  56                cd "$cli" &&
  57                ISO8859="$(printf "$ISO8859_ESCAPED")" &&
  58                p4 delete "$ISO8859" &&
  59                p4 submit -d "remove file"
  60        ) &&
  61        git p4 clone --destination="$git" //depot@all &&
  62        test_when_finished cleanup_git &&
  63        (
  64                cd "$git" &&
  65                git -c core.quotepath=false ls-files >actual &&
  66                test_must_be_empty actual
  67        )
  68'
  69
  70test_expect_success 'kill p4d' '
  71        kill_p4d
  72'
  73
  74test_done