Restore empty directories

The experimental git-ubuntu.experimental-emptydirfixup tool restores the empty directories locally as a workaround to the empty directory problem. It takes a non-merge commit and examines its parent to examine what empty directories have been lost. It provides an equivalent replacement commit.

Run it with fix-head to replace HEAD with a commit that has empty directories restored.

Run it with fix-many and a parameter pointing to a base commit to run git-rebase to fix a set of commits.

Note that in both cases, the parent must have the empty directories in order for them to be copied down through the fixed up commits. In the common case where this tool is needed, you’ll be starting from an “official” git-ubuntu import tag or branch, so this will be true in these cases. However, this does mean that you need to use fix-many all the way back to the first commit after such an “official” commit. If you have intermediary un-fixed commits and then just try to apply fix-head to the end, then it won’t work as the empty directories won’t get copied forward.

Example of use:

git ubuntu clone apache2
cd apache2
git tag -f base
<add commits>
git-ubuntu.experimental-emptydirfixup fix-many base
dpkg-buildpackage $(git ubuntu prepare-upload args) -S

See also: Empty directories.