t / t9817-git-p4-exclude.shon commit Merge branch 'rd/doc-remote-tracking-with-hyphen' (929c097)
   1#!/bin/sh
   2
   3test_description='git p4 tests for excluded paths during clone and sync'
   4
   5. ./lib-git-p4.sh
   6
   7test_expect_success 'start p4d' '
   8        start_p4d
   9'
  10
  11# Create a repo with the structure:
  12#
  13#    //depot/wanted/foo
  14#    //depot/discard/foo
  15#
  16# Check that we can exclude a subdirectory with both
  17# clone and sync operations.
  18
  19test_expect_success 'create exclude repo' '
  20        (
  21                cd "$cli" &&
  22                mkdir -p wanted discard &&
  23                echo wanted >wanted/foo &&
  24                echo discard >discard/foo &&
  25                p4 add wanted/foo discard/foo &&
  26                p4 submit -d "initial revision"
  27        )
  28'
  29
  30test_expect_success 'check the repo was created correctly' '
  31        test_when_finished cleanup_git &&
  32        git p4 clone --dest="$git" //depot/...@all &&
  33        (
  34                cd "$git" &&
  35                test_path_is_file wanted/foo &&
  36                test_path_is_file discard/foo
  37        )
  38'
  39
  40test_expect_success 'clone, excluding part of repo' '
  41        test_when_finished cleanup_git &&
  42        git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
  43        (
  44                cd "$git" &&
  45                test_path_is_file wanted/foo &&
  46                test_path_is_missing discard/foo
  47        )
  48'
  49
  50test_expect_success 'clone, then sync with exclude' '
  51        test_when_finished cleanup_git &&
  52        git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
  53        (
  54                cd "$cli" &&
  55                p4 edit wanted/foo discard/foo &&
  56                date >>wanted/foo &&
  57                date >>discard/foo &&
  58                p4 submit -d "updating" &&
  59
  60                cd "$git" &&
  61                git p4 sync -//depot/discard/... &&
  62                test_path_is_file wanted/foo &&
  63                test_path_is_missing discard/foo
  64        )
  65'
  66
  67test_expect_success 'kill p4d' '
  68        kill_p4d
  69'
  70
  71test_done