diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2012-07-18 13:25:24 +0300 |
---|---|---|
committer | Ed Bartosh <eduard.bartosh@intel.com> | 2012-07-18 13:25:24 +0300 |
commit | bd39cbd3c0d37c608681666d1dab9dc37bcb2c6b (patch) | |
tree | be12066008e760293c865706d226fd2cae5e9e50 | |
parent | 37d88d4aee1433c7e2c4b72cc561668f98359ade (diff) | |
download | git-buildpackage-bd39cbd3c0d37c608681666d1dab9dc37bcb2c6b.tar.gz git-buildpackage-bd39cbd3c0d37c608681666d1dab9dc37bcb2c6b.tar.bz2 git-buildpackage-bd39cbd3c0d37c608681666d1dab9dc37bcb2c6b.zip |
buildpackage/clone_index: Check if .git/index exists before copying
it. Fixes #199
Without this fix running git-buildpackage on just initialized git
repository (without .git/index) leads to this traceback:
File "gbp/scripts/common/buildpackage.py", line 146, in write_wc
clone_index()
File "gbp/scripts/common/buildpackage.py", line 159, in clone_index
shutil.copy2(".git/index", wc_index)
File "/usr/lib/python2.7/shutil.py", line 127, in copy2
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 81, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '.git/index'
Change-Id: If2c212a626e1e293ad0bf6101c6bd9990a49f088
-rw-r--r-- | gbp/scripts/common/buildpackage.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py index 215a875d..8fc02f14 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -156,4 +156,6 @@ def drop_index(): def clone_index(): """Copy the current index file to our custom index file""" - shutil.copy2(".git/index", wc_index) + indexfn = ".git/index" + if os.path.exists(indexfn): + shutil.copy2(indexfn, wc_index) |