summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiankang Fan <jiankang.fan@samsung.com>2016-09-28 10:26:09 +0800
committerSoonKyu Park <sk7.park@samsung.com>2016-12-26 22:20:35 +0900
commitc8c57f2042648a95ef80cfbc16b880bebdcb8ed2 (patch)
tree395011ebaecd304a4195399e010e2d862386e366
parent06e10c8b1f4f355e884d52a61b7762e733975d55 (diff)
downloadgit-buildpackage-c8c57f2042648a95ef80cfbc16b880bebdcb8ed2.tar.gz
git-buildpackage-c8c57f2042648a95ef80cfbc16b880bebdcb8ed2.tar.bz2
git-buildpackage-c8c57f2042648a95ef80cfbc16b880bebdcb8ed2.zip
GitRepository: Fix diff_status() for renames and copies
When file has been renamed or copied git places two filepaths in a status line. Previously, we concatenated them (with additional \x00) and put into a single record in results dictionary. This leads to records like: 'libusbg.pc.in\x00libusbgx.pc.in' and result in a exception while trying to invoke git diff on such record: error: Traceback (most recent call last): File "/usr/bin/gbs", line 628, in <module> sys.exit(main(sys.argv)) File "/usr/bin/gbs", line 622, in main return module.main(args) File "/usr/lib/pymodules/python2.7/gitbuildsys/cmd_export.py", line 302, in main export_sources(repo, commit, export_dir, main_spec, args) File "/usr/lib/pymodules/python2.7/gitbuildsys/cmd_export.py", line 222, in export_sources ret = gbp_build(gbp_args) File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage_rpm.py", line 588, in main export_patches(repo, spec, patch_tree, options) File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage_rpm.py", line 283, in export_patches update_patch_series(repo, spec, upstream_tree, export_treeish, options) File "/usr/lib/python2.7/dist-packages/gbp/scripts/pq_rpm.py", line 211, in update_patch_series spec.specdir, options) File "/usr/lib/python2.7/dist-packages/gbp/scripts/pq_rpm.py", line 144, in generate_patches options.patch_export_ignore_path) File "/usr/lib/python2.7/dist-packages/gbp/scripts/common/pq.py", line 290, in format_diff text=True) File "/usr/lib/python2.7/dist-packages/gbp/git/repository.py", line 1813, in diff output, stderr, ret = self._git_inout('diff', options.args) File "/usr/lib/python2.7/dist-packages/gbp/git/repository.py", line 187, in _git_inout capture_stdout): File "/usr/lib/python2.7/dist-packages/gbp/git/repository.py", line 245, in __git_inout cwd=cwd) File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1252, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings To fix this let's add each filepath as a seprate record as git diff command will understand our intentions perfectly. Change-Id: I4955bf341147d84880fb2aac49b19a290f1465e5 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
-rw-r--r--gbp/git/repository.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 20251a00..d7eb271e 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1837,7 +1837,8 @@ class GitRepository(object):
filepath = elements.pop(0)
# Expect to have two filenames for renames and copies
if status in ['R', 'C']:
- filepath = elements.pop(0) + '\x00' + filepath
+ result[status].append(filepath)
+ filepath = elements.pop(0)
result[status].append(filepath)
return result