问题
By design, Perforce does not allow filenames with wildcards @#%*
be added. It is giving this error:
Can't add filenames with wildcards [@#%*] in them.
Use -f option to force add.
However, I have SASS files that have @
on them to support mixins. For example:
carbon-fibre-@2X.png
sprite-dashboard-@2X.png
What is the best workaround to have these files added to Perforce, with most minimal disruption on checkin, checkout, compile, build, and deploy flow ?
回答1:
You can add files with Perforce wildcard characters in them. As the 'p4 help add' page documents:
To add files with filenames that contain wildcard characters, specify the -f flag. Filenames that contain the special characters '@', '#', '%' or '*' are reformatted to encode the characters using ASCII hexadecimal representation. After the files are added, you must refer to them using the reformatted file name, because Perforce does not recognize the local filesystem name.
The requirement to uniformly refer to the filename from then on using the encoded '%40' is annoying, I agree, but it does work.
Here's a short example:
$ touch 'carbon-fiber-@2X.png'
$ p4 add 'carbon-fiber-@2X.png'
The file named 'carbon-fiber-@2X.png' contains wildcards [@#%*].
Can't add filenames with wildcards [@#%*] in them.
Use -f option to force add.
$ p4 add -f 'carbon-fiber-@2X.png'
//depot/carbon-fiber-%402X.png#1 - opened for add
/path/to/carbon-fiber-@2X.png - empty, assuming text.
$ p4 submit -d added-carbon-fibre
Submitting change 2.
Locking 1 files ...
add //depot/carbon-fiber-%402X.png#1
Change 2 submitted.
$ p4 files //...
//depot/carbon-fiber-%402X.png#1 - add change 2 (text)
$ p4 fstat //depot/carbon-fiber-%402X.png
... depotFile //depot/carbon-fiber-%402X.png
... clientFile /path/to/carbon-fiber-@2X.png
... isMapped
... headAction add
... headType text
... headTime 1466547058
... headRev 1
... headChange 2
... headModTime 1466547033
... haveRev 1
来源:https://stackoverflow.com/questions/37952591/perforce-workaround-to-add-files-with