From: Junio C Hamano Date: Tue, 15 Dec 2015 17:34:18 +0000 (-0800) Subject: Merge branch 'ls/p4-keep-empty-commits' into maint X-Git-Tag: v2.7.0-rc1~1^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f97f2e5c645759ec3204ca99cbc5f61caf9201de Merge branch 'ls/p4-keep-empty-commits' into maint "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 --- f97f2e5c645759ec3204ca99cbc5f61caf9201de diff --cc git-p4.py index a79b6d82ab,4ad7c6890c..a7ec118706 --- a/git-p4.py +++ 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: