From f858dc4a83bd31c313edee111649bc426e8c9cf4 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 6 Jul 2012 16:45:54 +0300 Subject: 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 Signed-off-by: Ed Bartosh --- gbp/scripts/common/buildpackage.py | 11 +++++++++-- 1 file 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) -- cgit v1.2.3