summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiankang Fan <jiankang.fan@samsung.com>2016-09-28 10:26:09 +0800
committerJiankang Fan <jiankang.fan@samsung.com>2016-09-28 10:26:09 +0800
commit39ba758175b7cf7b1aeac2a0bca4f43894bbfef7 (patch)
tree80759733ee4b553676048bf6c95d9887c404ab61
parent7d042a8203461117e8743bf1e879af431d3c31cd (diff)
downloadgit-buildpackage-39ba758175b7cf7b1aeac2a0bca4f43894bbfef7.tar.gz
git-buildpackage-39ba758175b7cf7b1aeac2a0bca4f43894bbfef7.tar.bz2
git-buildpackage-39ba758175b7cf7b1aeac2a0bca4f43894bbfef7.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