aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-12-17 15:42:10 +0100
committerGuido Günther <agx@sigxcpu.org>2009-12-17 15:43:28 +0100
commite339c701d5c8264df093a15d9db236b710da5f2b (patch)
tree67a817ac8ad03cd39dfd3622df780ed0b3d49b7a
parenta0c7a91a507b20ed7c797376c98b02a368193ce5 (diff)
Make sure we drop the generated custom index file
Closes: #561454
-rwxr-xr-xgit-buildpackage10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-buildpackage b/git-buildpackage
index 7ca276c9..839af90f 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -36,6 +36,8 @@ from glob import glob
index_name = "INDEX"
# when we want to reference the working copy in treeish context we call it:
wc_name = "WC"
+# index file name used to export working copy
+wc_index = ".git/gbp_index"
def git_archive_pipe(prefix, pipe, output, treeish):
"""run the git_archive pipe"""
@@ -131,12 +133,16 @@ def git_archive_build_orig(repo, cp, output_dir, options):
def write_wc(repo):
"""write out the current working copy as a treeish object"""
tree = None
- os.putenv("GIT_INDEX_FILE", ".git/gbp_index")
+ os.putenv("GIT_INDEX_FILE", wc_index)
GitAdd()(['-f', '.'])
tree = repo.write_tree()
os.unsetenv("GIT_INDEX_FILE")
return tree
+def drop_index(repo):
+ """drop our custom index"""
+ if os.path.exists(wc_index):
+ os.unlink(wc_index)
def extract_orig(orig_tarball, dest_dir):
"""extract orig tarball to export dir before exporting from git"""
@@ -354,6 +360,8 @@ def main(argv):
if len(err.__str__()):
print >>sys.stderr, err
retval = 1
+ finally:
+ drop_index(repo)
if not options.tag_only:
if options.export_dir and options.purge and not retval: