summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-07-06 16:45:54 +0300
committerTzafrir Cohen <tzafrir@debian.org>2015-03-26 14:27:44 +0200
commitf858dc4a83bd31c313edee111649bc426e8c9cf4 (patch)
tree2d7d55eac2f42d41faa906a4713c8f9b8b18e535
parent17260812385a4107835b3095acb540ecfd534fd9 (diff)
buildpackage: add 'untracked' option to write_wc()
Whether to ignore untracked files (untracked=False) or not (untracked=True). Now, clones the temporary index file from the actual index, in order to correctly update files. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r--gbp/scripts/common/buildpackage.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py
index 111512f..dc47b75 100644
--- a/gbp/scripts/common/buildpackage.py
+++ b/gbp/scripts/common/buildpackage.py
@@ -145,9 +145,10 @@ def dump_tree(repo, export_dir, treeish, with_submodules, recursive=True):
return True
-def write_wc(repo, force=True):
+def write_wc(repo, force=True, untracked=True):
"""write out the current working copy as a treeish object"""
- repo.add_files(repo.path, force=force, index_file=wc_index)
+ clone_index()
+ repo.add_files(repo.path, force=force, untracked=untracked, index_file=wc_index)
tree = repo.write_tree(index_file=wc_index)
return tree
@@ -156,3 +157,9 @@ def drop_index():
"""drop our custom index"""
if os.path.exists(wc_index):
os.unlink(wc_index)
+
+def clone_index():
+ """Copy the current index file to our custom index file"""
+ indexfn = ".git/index"
+ if os.path.exists(indexfn):
+ shutil.copy2(indexfn, wc_index)