git p4: submit files with wildcards
There are four wildcard characters in p4. Files with these characters can be added to p4 repos using the "-f" option. They are stored in %xx notation, and when checked out, p4 converts them back to normal. When adding files with wildcards in git, the submit path must be careful to use the encoded names in some places, and it must use "-f" to add them. All other p4 commands that operate on the client directory expect encoded filenames as arguments. Support for wildcards in the clone/sync path was added in084f630
(git-p4: decode p4 wildcard characters, 2011-02-19), but that change did not handle the submit path. There was a problem with wildcards in the sync path too. Commit084f630
(git-p4: decode p4 wildcard characters, 2011-02-19) handled files with p4 wildcards that were added or modified in p4. Do this for deleted files, and also in branch detection checks, too. Reported-by: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b6ad6dcc3b
commit
9d7d446ae9
@ -163,6 +163,112 @@ test_expect_success 'wildcard files git p4 clone' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'wildcard files submit back to p4, add' '
|
||||
test_when_finished cleanup_git &&
|
||||
git p4 clone --dest="$git" //depot &&
|
||||
(
|
||||
cd "$git" &&
|
||||
echo git-wild-hash >git-wild#hash &&
|
||||
echo git-wild-star >git-wild\*star &&
|
||||
echo git-wild-at >git-wild@at &&
|
||||
echo git-wild-percent >git-wild%percent &&
|
||||
git add git-wild* &&
|
||||
git commit -m "add some wildcard filenames" &&
|
||||
git config git-p4.skipSubmitEdit true &&
|
||||
git p4 submit
|
||||
) &&
|
||||
(
|
||||
cd "$cli" &&
|
||||
test_path_is_file git-wild#hash &&
|
||||
test_path_is_file git-wild\*star &&
|
||||
test_path_is_file git-wild@at &&
|
||||
test_path_is_file git-wild%percent
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'wildcard files submit back to p4, modify' '
|
||||
test_when_finished cleanup_git &&
|
||||
git p4 clone --dest="$git" //depot &&
|
||||
(
|
||||
cd "$git" &&
|
||||
echo new-line >>git-wild#hash &&
|
||||
echo new-line >>git-wild\*star &&
|
||||
echo new-line >>git-wild@at &&
|
||||
echo new-line >>git-wild%percent &&
|
||||
git add git-wild* &&
|
||||
git commit -m "modify the wildcard files" &&
|
||||
git config git-p4.skipSubmitEdit true &&
|
||||
git p4 submit
|
||||
) &&
|
||||
(
|
||||
cd "$cli" &&
|
||||
test_line_count = 2 git-wild#hash &&
|
||||
test_line_count = 2 git-wild\*star &&
|
||||
test_line_count = 2 git-wild@at &&
|
||||
test_line_count = 2 git-wild%percent
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'wildcard files submit back to p4, copy' '
|
||||
test_when_finished cleanup_git &&
|
||||
git p4 clone --dest="$git" //depot &&
|
||||
(
|
||||
cd "$git" &&
|
||||
cp file2 git-wild-cp#hash &&
|
||||
git add git-wild-cp#hash &&
|
||||
cp git-wild\*star file-wild-3 &&
|
||||
git add file-wild-3 &&
|
||||
git commit -m "wildcard copies" &&
|
||||
git config git-p4.detectCopies true &&
|
||||
git config git-p4.detectCopiesHarder true &&
|
||||
git config git-p4.skipSubmitEdit true &&
|
||||
git p4 submit
|
||||
) &&
|
||||
(
|
||||
cd "$cli" &&
|
||||
test_path_is_file git-wild-cp#hash &&
|
||||
test_path_is_file file-wild-3
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'wildcard files submit back to p4, rename' '
|
||||
test_when_finished cleanup_git &&
|
||||
git p4 clone --dest="$git" //depot &&
|
||||
(
|
||||
cd "$git" &&
|
||||
git mv git-wild@at file-wild-4 &&
|
||||
git mv file-wild-3 git-wild-cp%percent &&
|
||||
git commit -m "wildcard renames" &&
|
||||
git config git-p4.detectRenames true &&
|
||||
git config git-p4.skipSubmitEdit true &&
|
||||
git p4 submit
|
||||
) &&
|
||||
(
|
||||
cd "$cli" &&
|
||||
test_path_is_missing git-wild@at &&
|
||||
test_path_is_file git-wild-cp%percent
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'wildcard files submit back to p4, delete' '
|
||||
test_when_finished cleanup_git &&
|
||||
git p4 clone --dest="$git" //depot &&
|
||||
(
|
||||
cd "$git" &&
|
||||
git rm git-wild* &&
|
||||
git commit -m "delete the wildcard files" &&
|
||||
git config git-p4.skipSubmitEdit true &&
|
||||
git p4 submit
|
||||
) &&
|
||||
(
|
||||
cd "$cli" &&
|
||||
test_path_is_missing git-wild#hash &&
|
||||
test_path_is_missing git-wild\*star &&
|
||||
test_path_is_missing git-wild@at &&
|
||||
test_path_is_missing git-wild%percent
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'clone bare' '
|
||||
git p4 clone --dest="$git" --bare //depot &&
|
||||
test_when_finished cleanup_git &&
|
||||
|
Reference in New Issue
Block a user