summaryrefslogtreecommitdiff
path: root/gbp/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-07-06 16:45:54 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-07-10 13:25:00 +0300
commitcb7dc72d32ca66949a777e60f8fcb5d6fc84a900 (patch)
tree979af2100f9214d3a0feed411a5c1eaac291ddbb /gbp/scripts
parent09e07245d3dccaaa129a06f74c7eaf1a72d1a1af (diff)
downloadgit-buildpackage-cb7dc72d32ca66949a777e60f8fcb5d6fc84a900.tar.gz
git-buildpackage-cb7dc72d32ca66949a777e60f8fcb5d6fc84a900.tar.bz2
git-buildpackage-cb7dc72d32ca66949a777e60f8fcb5d6fc84a900.zip
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>
Diffstat (limited to 'gbp/scripts')
-rw-r--r--gbp/scripts/common/buildpackage.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py
index 7480d4af..c1485aff 100644
--- a/gbp/scripts/common/buildpackage.py
+++ b/gbp/scripts/common/buildpackage.py
@@ -138,9 +138,10 @@ def dump_tree(repo, export_dir, treeish, with_submodules):
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
@@ -149,3 +150,7 @@ 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"""
+ shutil.copy2(".git/index", wc_index)