I have created a symbolic link directory in Unix and I would like to add it to perforce.
(this question relates to symlinks on Unix. Windows symbolic links can have very different behaviour from Unix.)
ln -s ../blah/dir1 dir2
If I right-click on "dir2" in the p4v GUI, it will add every file under ../blah/dir1 as a new file (even if these files are already in Perforce) and fubar everything.
If I do a "p4 add dir2" from the command line, it will add every file under ../blah/dir1 as a new file (even if these files are already in Perforce) and fubar everything.
What is the correct syntax?
Ln Command to Create Symbolic Links Use the -s option to create a soft (symbolic) link. The -f option will force the command to overwrite a file that already exists. Source is the file or directory being linked to.
Symlink, also known as a symbolic link in Linux, creates a link to a file or a directory for easier access. To put it in another way, symlinks are links that points to another file or folder in your system, quite similar to the shortcuts in Windows.
A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system.
Use cp -P (capital P) to never traverse any symbolic link and copy the symbolic link instead. This can be combined with other options such as -R to copy a directory hierarchy — cp -RL traverses all symbolic links to directories, cp -RP copies all symbolic links as such.
Perforce is able to detect symlinks itself and no special options need to be added in the command. Just regular command like following suffices the need
p4 add <sym link filename>
Add the symbolic link from the shell using the -t option to set the symlink type.
p4 add -t symlink dir2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With