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

diff --cc git-p4.py
index a79b6d82ab5ac8def38e7a213f0b990f4688379a,4ad7c6890cf57860a280169e73188a443cdc949c..a7ec1187066b90675f55e44103ba54e03d132caa
+++ b/git-p4.py
@@@ -2402,8 -2329,16 +2404,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: