Distbot assumes that the repository has been initialized if the
directory exists. This means that the repository won't be initialized
if an empty directory was passed to distbot.
This commit makes distbot check the specified repository a little more
thoroughly, to make sure empty directories will be initialized, too.
return 0
}
+looks_like_a_repository() {
+ local path="$1"
+
+ if ! [ -d "$path" ]; then
+ return 1
+ fi
+
+ if ! [ -d "$path/incoming" ]; then
+ return 1
+ fi
+
+ return 0
+}
+
main() {
local path
local codename
gpgkey=$(opt_get "gpgkey")
desc=$(opt_get "description")
- if ! [ -d "$path" ]; then
+ if ! looks_like_a_repository "$path"; then
# Create new repository
log_info "Initializing repository $name:$codename in $path"