How to handle file type changes in Perforce?

When you add a file to Perforce, it tries to determine what type of file it is (text, binary, utf16, etc.). He does a good job of this, but apparently never checks the file type again after the initial submission to version control. Recently, a colleague made changes to a text file that converted it to Unicode (utf16). Perforce did not recognize this and still considered it a text type, so when others extracted the file, it was corrupted.

We fixed the problem by re-adding the file and explicitly changing the file type to utf16, but would prefer this to happen automatically. There are ways to make him always use a certain type of encoding, but I don’t know if I like this idea. Has anyone dealt with and found a solution to this problem?

+3
source share
1 answer

Perforce tech support had this to say:

Perforce does not check the contents of a file when you submit editing.

Checking every single file for content is potentially very expensive. "text" and "utf16" are not the only types of files to search, a file can potentially change the type to "text", for example, "binary".

Another problem is that sometimes the user wants to override the default behavior of Perforce to recognize the file. How should the server respond to this case if the actual file type does not match the file type provides?

Perforce , " " "-t" .

, "-". , submit, .

+5

Source: https://habr.com/ru/post/1699165/


All Articles