aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/git
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-12-23 21:03:10 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-20 12:53:59 +0100
commitb8ea6621be6b96e8f2b187b503e1d788bf25b9ae (patch)
tree5ecc899c8f5ac9cbb014cb961814393541e90fc9 /gbp/git
parent6d2853a0637725c2d9e98112167d0fbe32b94900 (diff)
pq: Hardcode commit abbrev to 7 when exporting patches
This avoids path hurn with git >= 2.11.0 Closes: #848354
Diffstat (limited to 'gbp/git')
-rw-r--r--gbp/git/repository.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 654ec0b9..cc916a60 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1710,7 +1710,7 @@ class GitRepository(object):
self._git_command("apply", args)
def diff(self, obj1, obj2=None, paths=None, stat=False, summary=False,
- text=False, ignore_submodules=True):
+ text=False, ignore_submodules=True, abbrev=None):
"""
Diff two git repository objects
@@ -1732,6 +1732,7 @@ class GitRepository(object):
@rtype: C{str}
"""
options = GitArgs('-p', '--no-ext-diff')
+ config_args = GitArgs()
if stat is True:
options.add('--stat')
elif stat:
@@ -1743,7 +1744,11 @@ class GitRepository(object):
options.add_true(obj2, obj2)
if paths:
options.add('--', paths)
- output, stderr, ret = self._git_inout('diff', options.args)
+ if abbrev is not None:
+ config_args.add('core.abbrev=%d' % abbrev)
+ output, stderr, ret = self._git_inout('diff',
+ options.args,
+ config_args=config_args.args)
if ret:
raise GitRepositoryError("Git diff failed")
return output