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

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Nov 20, 2020

git archive doesn't have an option to include submodules, because obviously submodules can never be easy to work with. These arcane commands are the simplest solution I can think of, and seems to work well.

`git archive` doesn't have an option to include submodules, because
 obviously submodules can never be easy to work with. These arcane
commands are the simplest solution I can think of, and seems to work
well.
@ids1024 ids1024 requested review from a team November 20, 2020 18:42
Copy link
Contributor

@bflanagin bflanagin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but I need guidance on how to test it on our end before we can approve the change. Suggestions on how to use the associated command /scripts/ci is needed.

@jackpot51
Copy link
Member

jackpot51 commented Jan 26, 2021

@ids1024 I think this function can run in parallel, which would be a problem with the worktree command. Do you think this is the case?

@ids1024
Copy link
Member Author

ids1024 commented Jan 26, 2021

In parallel on different branches of the same repo? I think this should still work since it adds a worktree in a random out-of-tree directory, and git should use some form of locking to prevent synchronization bugs with two operations on the same repo. But it's hard to be sure because I don't have much experience with git worktrees, and it's kind of a horrible hack around git archive not supporting this natively.

Though looking at this again, it might be better to just call git archive for each submodule then extract them and tar into a single archive (tar has a --concatenate option, but it seems to have weird limitations...).

@ids1024
Copy link
Member Author

ids1024 commented Jan 26, 2021

Then again, that may run into other issues since it would need to retrieve the commit used for the submodule in the branch it is trying to archive, git submodule foreach probably only works with submodules that are currently checked out...

In gnome-control-center, I just worked around this by moving the upstream submodule in-tree. Perhaps it's best to stick with that, but I really wish git archive had support for submodules...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants