progrium / gitreceive

Easily accept and handle arbitrary git pushes
1.14k stars 108 forks source link

Error message for repo creation when file exits #33

Open Rogdham opened 10 years ago

Rogdham commented 10 years ago

When a file with the repo name exists in $GITHOME, exit with an error message.

This gives a proper error message (although I am open to suggestions for a better error message) when the user tries to create a repository but a file with the same name exits.

Example with the default settings (trying to create a repo named receiver, while a file with the same name exists in $GITHOME…):

Before:

$ git clone git@example.com:receiver
Cloning into 'receiver'...
Enter passphrase for key '<snip>': 
mkdir: cannot create directory '/home/git/receiver': File exists
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists

After this PR:

$ git clone git@git.debiantest.local:receiver
Cloning into 'receiver'...
Enter passphrase for key '<snip>': 
Fatal error: invalid repository name.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Do you think the error message should be made more obvious (e.g. by inserting a newline before and after)?