Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include submodules in git_archive_id() #1411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/git.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from subprocess import check_call, check_output
import tempfile

def git_ids_and_branches(cwd):
"""
Expand Down Expand Up @@ -53,4 +54,10 @@ def git_datetime_id(cwd, _id):


def git_archive_id(cwd, _id, archive):
return check_output(["git", "archive", "--format", "tar", "-o", archive, _id], cwd=cwd)
o = b''
with tempfile.TemporaryDirectory(dir=cwd) as d:
o += check_output(["git", "worktree", "add", d, _id], cwd=cwd)
o += check_output(["git", "submodule", "update", "--recursive"], cwd=d)
o += check_output(["tar", "--exclude", ".git", "-caf", archive, "."], cwd=d)
o += check_output(["git", "worktree", "remove", d], cwd=cwd)
return o