# bzr->git: keep empty directories

3 messages from 2012-07-14 to 2012-07-15. Participants: Felix Natter, David Aguilar, Steven Michalske.
Thread: https://gitlist.dev/t/31025

## Felix Natter, 2012-07-14 14:41

Subject: bzr->git: keep empty directories
Message-ID: <87sjcuz9q7.fsf@bitburger.home.felix>
URL: https://gitlist.dev/e/87sjcuz9q7.fsf%40bitburger.home.felix

```
hello,

when converting a repo from bzr to git:

mkdir freeplane-git1
cd freeplane-git1
git init .
bzr fast-export --plain --export-marks=../marks.bzr ../trunk/ | git fast-import --export-marks=../marks.git
git checkout

Empty directories are not contained in the git working index. This is
because of the --plain option, which "Excludes metadata to maximise
interoperability" and thus does not support empty directories
(http://doc.bazaar.canonical.com/plugins/en/fastimport-plugin.html).

However, when I use "--no-plain" (which according to above documentation
exports empty directories), git cannot handle it:

$ ./freeplane2git.sh 
Initialized empty Git repository in /home/felix/git/freeplane-git1/.git/
15:56:09 Calculating the revisions to include ...
15:56:09 Starting export of 4290 revisions ...
fatal: This version of fast-import does not support feature commit-properties.
fast-import: dumping crash report to .git/fast_import_crash_3915
bzr: broken pipe

I already tried to hack bzr-fastimport's exporter.py so that it does not
emit commit properties but emits empty directories but i was not
successful.

So is there another way to preserve empty directories or shall I report
a bug on bzr fast-export?

Many thanks in advance!
-- 
Felix Natter

```

## David Aguilar, 2012-07-14 22:46

Subject: Re: bzr->git: keep empty directories
Message-ID: <CAJDDKr5V++TtS24D=SsaPnkx==Zo8=fpvg2RNod9+-JGxWfhGQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAJDDKr5V%2B%2BTtS24D%3DSsaPnkx%3D%3DZo8%3Dfpvg2RNod9%2B-JGxWfhGQ%40mail.gmail.com
In-Reply-To: <87sjcuz9q7.fsf@bitburger.home.felix>

```
On Sat, Jul 14, 2012 at 7:41 AM, Felix Natter <fnatter@gmx.net> wrote:
> hello,
>
> when converting a repo from bzr to git:
>
> mkdir freeplane-git1
> cd freeplane-git1
> git init .
> bzr fast-export --plain --export-marks=../marks.bzr ../trunk/ | git fast-import --export-marks=../marks.git
> git checkout
>
> Empty directories are not contained in the git working index. This is
> because of the --plain option, which "Excludes metadata to maximise
> interoperability" and thus does not support empty directories
> (http://doc.bazaar.canonical.com/plugins/en/fastimport-plugin.html).
>
> However, when I use "--no-plain" (which according to above documentation
> exports empty directories), git cannot handle it:
>
> $ ./freeplane2git.sh
> Initialized empty Git repository in /home/felix/git/freeplane-git1/.git/
> 15:56:09 Calculating the revisions to include ...
> 15:56:09 Starting export of 4290 revisions ...
> fatal: This version of fast-import does not support feature commit-properties.
> fast-import: dumping crash report to .git/fast_import_crash_3915
> bzr: broken pipe
>
> I already tried to hack bzr-fastimport's exporter.py so that it does not
> emit commit properties but emits empty directories but i was not
> successful.
>
> So is there another way to preserve empty directories or shall I report
> a bug on bzr fast-export?
>
> Many thanks in advance!

I would suggest hacking it to optionally not emit commit properties as step one.

A later enhancement would be to optionally create directories with
empty .gitignore files, or something similar. git really doesn't care
about empty directories.
-- 
David

```

## Steven Michalske, 2012-07-15 04:01

Subject: Re: bzr->git: keep empty directories
Message-ID: <2059FC03-7308-4BAD-B90A-451F71791187@gmail.com>
URL: https://gitlist.dev/e/2059FC03-7308-4BAD-B90A-451F71791187%40gmail.com
In-Reply-To: <CAJDDKr5V++TtS24D=SsaPnkx==Zo8=fpvg2RNod9+-JGxWfhGQ@mail.gmail.com>

```
Perhaps having a file named something like:

.git_foreign_scm_empty_dir  or some shorter name.

With the contents of the fast importer empty directory info put in there; If any book keeping is needed.

It also looks like you strip out meta-data.
perhaps a file like:

.git_foreign_scm_metadata

We could use the .git/config file format for storing the bookkeeping data.

Steve

On Jul 14, 2012, at 3:46 PM, David Aguilar wrote:

> On Sat, Jul 14, 2012 at 7:41 AM, Felix Natter <fnatter@gmx.net> wrote:
>> hello,
>> 
>> when converting a repo from bzr to git:
>> 
>> mkdir freeplane-git1
>> cd freeplane-git1
>> git init .
>> bzr fast-export --plain --export-marks=../marks.bzr ../trunk/ | git fast-import --export-marks=../marks.git
>> git checkout
>> 
>> Empty directories are not contained in the git working index. This is
>> because of the --plain option, which "Excludes metadata to maximise
>> interoperability" and thus does not support empty directories
>> (http://doc.bazaar.canonical.com/plugins/en/fastimport-plugin.html).
>> 
>> However, when I use "--no-plain" (which according to above documentation
>> exports empty directories), git cannot handle it:
>> 
>> $ ./freeplane2git.sh
>> Initialized empty Git repository in /home/felix/git/freeplane-git1/.git/
>> 15:56:09 Calculating the revisions to include ...
>> 15:56:09 Starting export of 4290 revisions ...
>> fatal: This version of fast-import does not support feature commit-properties.
>> fast-import: dumping crash report to .git/fast_import_crash_3915
>> bzr: broken pipe
>> 
>> I already tried to hack bzr-fastimport's exporter.py so that it does not
>> emit commit properties but emits empty directories but i was not
>> successful.
>> 
>> So is there another way to preserve empty directories or shall I report
>> a bug on bzr fast-export?
>> 
>> Many thanks in advance!
> 
> I would suggest hacking it to optionally not emit commit properties as step one.
> 
> A later enhancement would be to optionally create directories with
> empty .gitignore files, or something similar. git really doesn't care
> about empty directories.
> -- 
> David
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```
