]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ls/p4-keep-empty-commits'
authorJunio C Hamano <gitster@pobox.com>
Tue, 15 Dec 2015 16:02:18 +0000 (08:02 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Dec 2015 16:02:19 +0000 (08:02 -0800)
"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

1  2 
Documentation/git-p4.txt
git-p4.py

index c3ff7d0d9b1a62709128c985bcc7e8943756949a,b3e768ee81084acf447072b448e738671b6401f5..738cfde10c84b606e2d341fc2ff597403d1b987b
@@@ -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 13f124061f43a4bc212066f865aaaac39feb5385,4ad7c6890cf57860a280169e73188a443cdc949c..7a9dd6ad74580f648813a97c5012e6ef4f837896
+++ 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: