t / t9812-git-p4-wildcards.shon commit git-send-email: remove garbage after email address (831a488)
   1#!/bin/sh
   2
   3test_description='git p4 wildcards'
   4
   5. ./lib-git-p4.sh
   6
   7test_expect_success 'start p4d' '
   8        start_p4d
   9'
  10
  11test_expect_success 'add p4 files with wildcards in the names' '
  12        (
  13                cd "$cli" &&
  14                printf "file2\nhas\nsome\nrandom\ntext\n" >file2 &&
  15                p4 add file2 &&
  16                echo file-wild-hash >file-wild#hash &&
  17                echo file-wild-star >file-wild\*star &&
  18                echo file-wild-at >file-wild@at &&
  19                echo file-wild-percent >file-wild%percent &&
  20                p4 add -f file-wild* &&
  21                p4 submit -d "file wildcards"
  22        )
  23'
  24
  25test_expect_success 'wildcard files git p4 clone' '
  26        git p4 clone --dest="$git" //depot &&
  27        test_when_finished cleanup_git &&
  28        (
  29                cd "$git" &&
  30                test -f file-wild#hash &&
  31                test -f file-wild\*star &&
  32                test -f file-wild@at &&
  33                test -f file-wild%percent
  34        )
  35'
  36
  37test_expect_success 'wildcard files submit back to p4, add' '
  38        test_when_finished cleanup_git &&
  39        git p4 clone --dest="$git" //depot &&
  40        (
  41                cd "$git" &&
  42                echo git-wild-hash >git-wild#hash &&
  43                echo git-wild-star >git-wild\*star &&
  44                echo git-wild-at >git-wild@at &&
  45                echo git-wild-percent >git-wild%percent &&
  46                git add git-wild* &&
  47                git commit -m "add some wildcard filenames" &&
  48                git config git-p4.skipSubmitEdit true &&
  49                git p4 submit
  50        ) &&
  51        (
  52                cd "$cli" &&
  53                test_path_is_file git-wild#hash &&
  54                test_path_is_file git-wild\*star &&
  55                test_path_is_file git-wild@at &&
  56                test_path_is_file git-wild%percent
  57        )
  58'
  59
  60test_expect_success 'wildcard files submit back to p4, modify' '
  61        test_when_finished cleanup_git &&
  62        git p4 clone --dest="$git" //depot &&
  63        (
  64                cd "$git" &&
  65                echo new-line >>git-wild#hash &&
  66                echo new-line >>git-wild\*star &&
  67                echo new-line >>git-wild@at &&
  68                echo new-line >>git-wild%percent &&
  69                git add git-wild* &&
  70                git commit -m "modify the wildcard files" &&
  71                git config git-p4.skipSubmitEdit true &&
  72                git p4 submit
  73        ) &&
  74        (
  75                cd "$cli" &&
  76                test_line_count = 2 git-wild#hash &&
  77                test_line_count = 2 git-wild\*star &&
  78                test_line_count = 2 git-wild@at &&
  79                test_line_count = 2 git-wild%percent
  80        )
  81'
  82
  83test_expect_success 'wildcard files submit back to p4, copy' '
  84        test_when_finished cleanup_git &&
  85        git p4 clone --dest="$git" //depot &&
  86        (
  87                cd "$git" &&
  88                cp file2 git-wild-cp#hash &&
  89                git add git-wild-cp#hash &&
  90                cp git-wild\*star file-wild-3 &&
  91                git add file-wild-3 &&
  92                git commit -m "wildcard copies" &&
  93                git config git-p4.detectCopies true &&
  94                git config git-p4.detectCopiesHarder true &&
  95                git config git-p4.skipSubmitEdit true &&
  96                git p4 submit
  97        ) &&
  98        (
  99                cd "$cli" &&
 100                test_path_is_file git-wild-cp#hash &&
 101                test_path_is_file file-wild-3
 102        )
 103'
 104
 105test_expect_success 'wildcard files submit back to p4, rename' '
 106        test_when_finished cleanup_git &&
 107        git p4 clone --dest="$git" //depot &&
 108        (
 109                cd "$git" &&
 110                git mv git-wild@at file-wild-4 &&
 111                git mv file-wild-3 git-wild-cp%percent &&
 112                git commit -m "wildcard renames" &&
 113                git config git-p4.detectRenames true &&
 114                git config git-p4.skipSubmitEdit true &&
 115                git p4 submit
 116        ) &&
 117        (
 118                cd "$cli" &&
 119                test_path_is_missing git-wild@at &&
 120                test_path_is_file git-wild-cp%percent
 121        )
 122'
 123
 124test_expect_success 'wildcard files submit back to p4, delete' '
 125        test_when_finished cleanup_git &&
 126        git p4 clone --dest="$git" //depot &&
 127        (
 128                cd "$git" &&
 129                git rm git-wild* &&
 130                git commit -m "delete the wildcard files" &&
 131                git config git-p4.skipSubmitEdit true &&
 132                git p4 submit
 133        ) &&
 134        (
 135                cd "$cli" &&
 136                test_path_is_missing git-wild#hash &&
 137                test_path_is_missing git-wild\*star &&
 138                test_path_is_missing git-wild@at &&
 139                test_path_is_missing git-wild%percent
 140        )
 141'
 142
 143test_expect_success 'kill p4d' '
 144        kill_p4d
 145'
 146
 147test_done