summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)