Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Prepare for 4.1.4
Browse files Browse the repository at this point in the history
Only add commit if tarball is being unpacked. Items in sources directory
other than tarball may exist
  • Loading branch information
samuelconnolly committed Feb 1, 2019
1 parent b70128f commit 265d8d0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions planex/cmd/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def extract(url_str, destination):
Fetch a non-git resource and create a git repository
"""
archive_file = None

# pylint: disable=no-member
destination.mkdir(parents=True, exist_ok=True)
repo = git.Repo.init(str(destination))
Expand Down Expand Up @@ -220,18 +219,17 @@ def extract(url_str, destination):

# extract the archive
if tarfile.is_tarfile(archive_path):
tara = tarfile.open(archive_path)
tara.extractall(str(destination))
tara.close()
logging.info("Fetch and extract %s into %s", url_str, destination)
with tarfile.open(archive_path) as tara:
tara.extractall(str(destination))
index = repo.index
index.add(find_all_files(str(destination)))
index.commit("Repo generated by planex-clone")

if archive_file:
# delete temp file
archive_file.close()

index = repo.index
index.add(find_all_files(str(destination)))
index.commit("Repo generated by planex-clone")

return repo


Expand All @@ -244,7 +242,6 @@ def clone_resource(resource, destination):
resource.commitish, destination)
repo = clone(resource.url, destination, resource.commitish)
else:
logging.info("Fetch and extract %s into %s", resource.url, destination)
repo = extract(resource.url, destination)

return repo
Expand Down

0 comments on commit 265d8d0

Please sign in to comment.