From: Junio C Hamano Date: Tue, 15 Dec 2015 16:02:18 +0000 (-0800) Subject: Merge branch 'ls/p4-keep-empty-commits' X-Git-Tag: v2.7.0-rc1~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a899d500c6255c245586e5ef366ad2d99e5db81c Merge branch 'ls/p4-keep-empty-commits' "git p4" used to import Perforce CLs that touch only paths outside the client spec as empty commits. It has been corrected to ignore them instead, with a new configuration git-p4.keepEmptyCommits as a backward compatibility knob. * ls/p4-keep-empty-commits: git-p4: add option to keep empty commits --- a899d500c6255c245586e5ef366ad2d99e5db81c diff --cc Documentation/git-p4.txt index c3ff7d0d9b,b3e768ee81..738cfde10c --- a/Documentation/git-p4.txt +++ b/Documentation/git-p4.txt @@@ -510,45 -510,10 +510,49 @@@ git-p4.useClientSpec: option '--use-client-spec'. See the "CLIENT SPEC" section above. This variable is a boolean, not the name of a p4 client. +git-p4.pathEncoding:: + Perforce keeps the encoding of a path as given by the originating OS. + Git expects paths encoded as UTF-8. Use this config to tell git-p4 + what encoding Perforce had used for the paths. This encoding is used + to transcode the paths to UTF-8. As an example, Perforce on Windows + often uses “cp1252” to encode path names. + +git-p4.largeFileSystem:: + Specify the system that is used for large (binary) files. Please note + that large file systems do not support the 'git p4 submit' command. + Only Git LFS [1] is implemented right now. Download + and install the Git LFS command line extension to use this option + and configure it like this: ++ +------------- +git config git-p4.largeFileSystem GitLFS +------------- ++ + [1] https://git-lfs.github.com/ + +git-p4.largeFileExtensions:: + All files matching a file extension in the list will be processed + by the large file system. Do not prefix the extensions with '.'. + +git-p4.largeFileThreshold:: + All files with an uncompressed size exceeding the threshold will be + processed by the large file system. By default the threshold is + defined in bytes. Add the suffix k, m, or g to change the unit. + +git-p4.largeFileCompressedThreshold:: + All files with a compressed size exceeding the threshold will be + processed by the large file system. This option might slow down + your clone/sync process. By default the threshold is defined in + bytes. Add the suffix k, m, or g to change the unit. + +git-p4.largeFilePush:: + Boolean variable which defines if large files are automatically + pushed to a server. + + git-p4.keepEmptyCommits:: + A changelist that contains only excluded files will be imported + as an empty commit if this boolean option is set to true. + Submit variables ~~~~~~~~~~~~~~~~ git-p4.detectRenames:: diff --cc git-p4.py index 13f124061f,4ad7c6890c..7a9dd6ad74 --- a/git-p4.py +++ b/git-p4.py @@@ -2651,8 -2329,16 +2653,16 @@@ class P4Sync(Command, P4UserMap) if self.clientSpecDirs: self.clientSpecDirs.update_client_spec_path_cache(files) + files = [f for f in files + if self.inClientSpec(f['path']) and self.hasBranchPrefix(f['path'])] + + if not files and not gitConfigBool('git-p4.keepEmptyCommits'): + print('Ignoring revision {0} as it would produce an empty commit.' + .format(details['change'])) + return + self.gitStream.write("commit %s\n" % branch) -# gitStream.write("mark :%s\n" % details["change"]) + self.gitStream.write("mark :%s\n" % details["change"]) self.committedChanges.add(int(details["change"])) committer = "" if author not in self.users: