Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 18 lines (15 sloc) 0.685 kb
#!/bin/sh
# git-store-dirs
# File ID: 8853c3a0-6be6-11df-8fcb-90e6ba3022ac
# Store a list of all directories to $dirfile to be able to restore empty
# directories. The list is \0-separated in case there are some directory names
# containing (ugh) \n. Use git-restore-dirs(1) to recreate directories.
dirfile=.emptydirs
test -d .git/. || { echo $0: Has to be run from the toplevel of the working tree >&2; exit 1; }
find -type d -empty -print0 | grep -E -v -z '/\.git(/|$)' | LC_ALL=C sort -z >$dirfile
test "$(cat $dirfile)" = "" &&
(
git reset $dirfile
rm $dirfile
echo "$0: No empty directories found, deleting $dirfile" >&2
) || git add $dirfile
Jump to Line
Something went wrong with that request. Please try again.