cirocosta / gitserver-http

git-http-backend with repository initialization
MIT License
21 stars 22 forks source link

Container was not starting. #8

Closed bunchc closed 7 years ago

bunchc commented 7 years ago

Turns out in a prior commit the startup sequence was refactored, removing the case statement that checked for parameters. Instead of putting that back, I added a conditional to check if there is anything in $GIT_INITIAL_REPO and run the init.

I also added an additional conditional to check file permissions before running chmod/chown, as this caused no small amount of permission denied errors when $GIT_PROJECT_ROOT is a volume with existing repos.

A make test runs clean here:

$ make test
./test.sh
+ trap cleanup EXIT
+ main
+ init_docker_container
+ docker-compose -f ./example/docker-compose.yml up -d
Creating network "example_default" with the default driver
Creating example_gitserver_1 ...
Creating example_gitserver_1 ... done
+ sleep 3
+ assert_can_clone
+ git clone http://localhost:8080/myrepo.git
Cloning into 'myrepo'...
remote: warning: unable to access '/root/.config/git/attributes': Permission denied
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
+ [[ -f myrepo/myfile.txt ]]
+ echo 'OK!'
OK!
+ cleanup
+ local exit_code=0
+ echo 'Exited with [0]'
Exited with [0]
+ docker-compose -f ./example/docker-compose.yml stop
Stopping example_gitserver_1 ... done
+ rm -rf ./myrepo
cirocosta commented 7 years ago

Nice! That seems pretty good, thx @bunchc !