git-ecosystem / git-bundle-server

A web server & management CLI to host Git bundles for use with Git's "bundle URIs" feature
Other
43 stars 20 forks source link

File creation bugfix for `init` + misc cleanup #26

Closed vdye closed 1 year ago

vdye commented 1 year ago

Closes #13.

The first two commits remove Wishlist.md (replaced with issues linked in the commit description) and doc.go (I think it's just unused?). The third commit fixes #13 by creating leading parent directories returning an empty result if the file doesn't exist, and the fourth improves error reporting when trying to read the file.

Manual testing confirmed that the missing file doesn't trigger an error (and that it's still successfully created by CreateRepository()). I was also able to trigger an intentional failure of ReadFileLines() (by creating ~/git-bundle-server with sudo mkdir -m 700 ~/git-bundle-server) and confirmed that the permission denied error was reported:

$ git-bundle-server init git@github.com:rust-lang/rust.git rust-lang/rust
2023/02/16 13:55:02 Failed with error: failed to parse routes file: open /Users/vdye/git-bundle-server//routes: permission denied