#!/bin/sh global test_description := ''git p4 tests for excluded paths during clone and sync'' source ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # Create a repo with the structure: # # //depot/wanted/foo # //depot/discard/foo # # Check that we can exclude a subdirectory with both # clone and sync operations. test_expect_success 'create exclude repo' ' ( cd "$cli" && mkdir -p wanted discard && echo wanted >wanted/foo && echo discard >discard/foo && p4 add wanted/foo discard/foo && p4 submit -d "initial revision" ) ' test_expect_success 'check the repo was created correctly' ' test_when_finished cleanup_git && git p4 clone --dest="$git" //depot/...@all && ( cd "$git" && test_path_is_file wanted/foo && test_path_is_file discard/foo ) ' test_expect_success 'clone, excluding part of repo' ' test_when_finished cleanup_git && git p4 clone -//depot/discard/... --dest="$git" //depot/...@all && ( cd "$git" && test_path_is_file wanted/foo && test_path_is_missing discard/foo ) ' test_expect_success 'clone, then sync with exclude' ' test_when_finished cleanup_git && git p4 clone -//depot/discard/... --dest="$git" //depot/...@all && ( cd "$cli" && p4 edit wanted/foo discard/foo && date >>wanted/foo && date >>discard/foo && p4 submit -d "updating" && cd "$git" && git p4 sync -//depot/discard/... && test_path_is_file wanted/foo && test_path_is_missing discard/foo ) ' test_expect_success 'kill p4d' ' kill_p4d ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git p4 tests for excluded paths during clone and sync">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./lib-git-p4.sh)}) (C {(test_expect_success)} {(SQ <"start p4d">)} {(SQ <"\n"> <"\tstart_p4d\n">)}) (C {(test_expect_success)} {(SQ <"create exclude repo">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\tmkdir -p wanted discard &&\n"> <"\t\techo wanted >wanted/foo &&\n"> <"\t\techo discard >discard/foo &&\n"> <"\t\tp4 add wanted/foo discard/foo &&\n"> <"\t\tp4 submit -d \"initial revision\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"check the repo was created correctly">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot/...@all &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_path_is_file wanted/foo &&\n"> <"\t\ttest_path_is_file discard/foo\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone, excluding part of repo">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone -//depot/discard/... --dest=\"$git\" //depot/...@all &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_path_is_file wanted/foo &&\n"> <"\t\ttest_path_is_missing discard/foo\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone, then sync with exclude">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone -//depot/discard/... --dest=\"$git\" //depot/...@all &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\tp4 edit wanted/foo discard/foo &&\n"> <"\t\tdate >>wanted/foo &&\n"> <"\t\tdate >>discard/foo &&\n"> <"\t\tp4 submit -d \"updating\" &&\n"> <"\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit p4 sync -//depot/discard/... &&\n"> <"\t\ttest_path_is_file wanted/foo &&\n"> <"\t\ttest_path_is_missing discard/foo\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"kill p4d">)} {(SQ <"\n"> <"\tkill_p4d\n">)}) (C {(test_done)}) ] )