Re: [PATCH] Add git-submodule command
- From
Simon Hausmann <simon@lst.de>
- Date
- May 26, 2007, 14:37 UTC
- Message-ID
- <200705261638.00302.simon@lst.de>
- In-Reply-To
- <11801878003599-git-send-email-hjemli@gmail.com>
On Saturday 26 May 2007 15:56:40 Lars Hjemli wrote: [...]
Show 24 quoted lines
> +modules_init()
> +{
> + git ls-files --stage -- "$@" | grep -e '^160000 ' |
> + while read mode sha1 stage path
> + do
> + # Skip submodule paths that already contain a .git directory.
> + # This will also trigger if $path is a symlink to a git
> + # repository
> + test -d "$path"/.git && continue
> +
> + # If there already is a directory at the submodule path,
> + # expect it to be empty (since that is the default checkout
> + # action) and try to remove it.
> + # Note: if $path is a symlink to a directory the test will
> + # succeed but the rmdir will fail. We might want to fix this.
> + if test -d "$path"
> + then
> + rmdir "$path" 2>/dev/null ||
> + die "Directory '$path' exist, but is neither empty "
> + "nor a git repository"
> + fi
> +
> + test -e "$path"
> + die "A file already exist at path '$path'"Isn't there a && missing at the end of the test line? :)
Simon