# git-archive ignores submodules

7 messages from 2015-04-16 to 2015-04-20. Participants: Pedro Rodrigues, Fredrik Gustafsson, Jens Lehmann, Kevin Daudt, Chris Packham.
Thread: https://gitlist.dev/t/39096

## Pedro Rodrigues, 2015-04-16 17:35

Subject: git-archive ignores submodules
Message-ID: <CAL1ZDKZs++NkLoHZ_w_YebQuZYG3rgAiH5SsaQfTmb9MPHjR3w@mail.gmail.com>
URL: https://gitlist.dev/e/CAL1ZDKZs%2B%2BNkLoHZ_w_YebQuZYG3rgAiH5SsaQfTmb9MPHjR3w%40mail.gmail.com

```
I've been using git-archive as my main way of deploying to production
servers, but today I've come across a git repo with submodules and
found out that git archive has no option to include submodules on the
output archive.

This simply makes git-archive unusable on this scenario.

-- 
Pedro Rodrigues
+244 917 774 823
+351 969 042 335
Mail: prodrigues1990@gmail.com

```

## Fredrik Gustafsson, 2015-04-16 17:56

Subject: Re: git-archive ignores submodules
Message-ID: <20150416175623.GJ21868@paksenarrion.iveqy.com>
URL: https://gitlist.dev/e/20150416175623.GJ21868%40paksenarrion.iveqy.com
In-Reply-To: <CAL1ZDKZs++NkLoHZ_w_YebQuZYG3rgAiH5SsaQfTmb9MPHjR3w@mail.gmail.com>

```
On Thu, Apr 16, 2015 at 06:35:38PM +0100, Pedro Rodrigues wrote:
> I've been using git-archive as my main way of deploying to production
> servers, but today I've come across a git repo with submodules and
> found out that git archive has no option to include submodules on the
> output archive.

As far as I know this is an known limitation that's just waiting for
someone to solve. Thanks for bringing attention to it.

> This simply makes git-archive unusable on this scenario.

Not completely. There's a simple workaround. Combine git submodule
foreach with git archive and make an archive for each submodule.

Not as simple as if git archive --recurse-submodule would have been
implementet, but hopefully it can make things work for you at the
moment.

-- 
Fredrik Gustafsson

phone: +46 733-608274
e-mail: iveqy@iveqy.com
website: http://www.iveqy.com

```

## Pedro Rodrigues, 2015-04-16 18:09

Subject: Re: git-archive ignores submodules
Message-ID: <CAL1ZDKbcmrer481fRY2NEHUQ1J5tjRbHz2yLEcszh3Q-NjcvcQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAL1ZDKbcmrer481fRY2NEHUQ1J5tjRbHz2yLEcszh3Q-NjcvcQ%40mail.gmail.com
In-Reply-To: <20150416175623.GJ21868@paksenarrion.iveqy.com>

```
Good to know about git submodule foreach.

Simpler yet, I'm using:

zip -r ../project.zip . -x *.git*

Which essentially does the same thing I would need from git-archive
--recurse-submodule, zip everything excluding .git folders. Still
would be better to use git itself.

2015-04-16 18:56 GMT+01:00 Fredrik Gustafsson <iveqy@iveqy.com>:
> On Thu, Apr 16, 2015 at 06:35:38PM +0100, Pedro Rodrigues wrote:
>> I've been using git-archive as my main way of deploying to production
>> servers, but today I've come across a git repo with submodules and
>> found out that git archive has no option to include submodules on the
>> output archive.
>
> As far as I know this is an known limitation that's just waiting for
> someone to solve. Thanks for bringing attention to it.
>
>> This simply makes git-archive unusable on this scenario.
>
> Not completely. There's a simple workaround. Combine git submodule
> foreach with git archive and make an archive for each submodule.
>
> Not as simple as if git archive --recurse-submodule would have been
> implementet, but hopefully it can make things work for you at the
> moment.
>
> --
> Fredrik Gustafsson
>
> phone: +46 733-608274
> e-mail: iveqy@iveqy.com
> website: http://www.iveqy.com



-- 
Pedro Rodrigues
+244 917 774 823
+351 969 042 335
Mail: prodrigues1990@gmail.com

```

## Jens Lehmann, 2015-04-16 19:03

Subject: Re: git-archive ignores submodules
Message-ID: <5530076E.50605@web.de>
URL: https://gitlist.dev/e/5530076E.50605%40web.de
In-Reply-To: <CAL1ZDKbcmrer481fRY2NEHUQ1J5tjRbHz2yLEcszh3Q-NjcvcQ@mail.gmail.com>

```
Am 16.04.2015 um 20:09 schrieb Pedro Rodrigues:
> Good to know about git submodule foreach.
>
> Simpler yet, I'm using:
>
> zip -r ../project.zip . -x *.git*
>
> Which essentially does the same thing I would need from git-archive
> --recurse-submodule, zip everything excluding .git folders. Still
> would be better to use git itself.

Yes.

> 2015-04-16 18:56 GMT+01:00 Fredrik Gustafsson <iveqy@iveqy.com>:
>> On Thu, Apr 16, 2015 at 06:35:38PM +0100, Pedro Rodrigues wrote:
>>> I've been using git-archive as my main way of deploying to production
>>> servers, but today I've come across a git repo with submodules and
>>> found out that git archive has no option to include submodules on the
>>> output archive.
>>
>> As far as I know this is an known limitation that's just waiting for
>> someone to solve. Thanks for bringing attention to it.

I just rebased a patch Lars Hjemli posted in 2009 (which I kept in my
GitHub repo to resurrect it when I find the time) to current master:

https://github.com/jlehmann/git-submod-enhancements/commits/archive--submodules

See gmane/$107030 for its original posting. Apart from renaming the
'--submodule' option to '--recurse-submodules' and solving a merge
conflict I didn't change anything. Not sure why it wasn't accepted
back then, I'll have to read that thread more closely ...

If people are interested I could try to polish it and resubmit it.
It would be great if Pedro could test that it does what he expects.

```

## Pedro Rodrigues, 2015-04-16 19:59

Subject: Re: git-archive ignores submodules
Message-ID: <CAL1ZDKbvNvTA3CFg5iWMYpOVDbxFwtpFCu+PO2onssO=+pw5XQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAL1ZDKbvNvTA3CFg5iWMYpOVDbxFwtpFCu%2BPO2onssO%3D%2Bpw5XQ%40mail.gmail.com
In-Reply-To: <5530076E.50605@web.de>

```
I sure can. Just send me an ID I can pull and test in here (not really
into C, so this the least I can contribute).

Although, my expectations are very simple, I just expect(ed) the exact
same git-archive command to be run on submodule(s), and have an output
on a single zip|tar|whatever file.

Not completely off topic, but for consistency consider that:
git-clone supports --recursive and --recurse-submodules, which do the
same thing.
git-pull and git-push only support --recurse-submodules.

```

## Kevin Daudt, 2015-04-19 16:19

Subject: Re: git-archive ignores submodules
Message-ID: <20150419161939.GC29542@vps892.directvps.nl>
URL: https://gitlist.dev/e/20150419161939.GC29542%40vps892.directvps.nl
In-Reply-To: <5530076E.50605@web.de>

```
On Thu, Apr 16, 2015 at 09:03:10PM +0200, Jens Lehmann wrote:
> Am 16.04.2015 um 20:09 schrieb Pedro Rodrigues:
> 
> If people are interested I could try to polish it and resubmit it.
> It would be great if Pedro could test that it does what he expects.

I'm certainly interested.

```

## Chris Packham, 2015-04-20 08:51

Subject: Re: git-archive ignores submodules
Message-ID: <CAFOYHZAZvidjtTzyhF2_nD_bi27H-h=GT4F-MKm+h3RT5LB_gw@mail.gmail.com>
URL: https://gitlist.dev/e/CAFOYHZAZvidjtTzyhF2_nD_bi27H-h%3DGT4F-MKm%2Bh3RT5LB_gw%40mail.gmail.com
In-Reply-To: <CAL1ZDKbvNvTA3CFg5iWMYpOVDbxFwtpFCu+PO2onssO=+pw5XQ@mail.gmail.com>

```
On Fri, Apr 17, 2015 at 7:59 AM, Pedro Rodrigues
<prodrigues1990@gmail.com> wrote:
<snip>

> Not completely off topic, but for consistency consider that:
> git-clone supports --recursive and --recurse-submodules, which do the
> same thing.
> git-pull and git-push only support --recurse-submodules.

It took a while to get the terminology sorted but the eventual
agreement[1] was "--recurse-submodules" was the best generally
applicable flag for all commands. For backwards compatibility some
commands that already had "--recursive" as an option have retained it

--
[1] - http://article.gmane.org/gmane.comp.version-control.git/160634

```
