icyphox / legit

web frontend for git
https://git.icyphox.sh
MIT License
376 stars 25 forks source link

go-import tags don't work as expected for bare repos with .git suffix #34

Closed wbrijesh closed 2 months ago

wbrijesh commented 2 months ago

I like using legit a lot, but every time I want a git server I end up rewriting some parts of legit to use with soft-serve

The only issue is legit expects bare repositories without .git in their name and soft-serve expects .git, this is fine at first but it causes issues with go-import meta tag which doesn't work

I could just use legit without soft-serve but user management is a hassle without soft-serve, Soft serve also has go-import tags built it but it doesn't have a web gui

I think using .git suffix is not required but common with bare repos, if you can fix this legit along with soft serve would be the perfect combination.

wbrijesh commented 2 months ago

I would like to create a PR with the changes that I normally make. Specifically, when a request is made to a URL without the .git extension I add .git to repository name from URL to show the page

But I'm not sure if this is the right approach, a much better way would be to add a flag in the config file but I couldn't figure out how to write this

something like this

repo:
  scanPath: /var/www/git
  readme:
    - readme
    - README
    - readme.md
    - README.md
  mainBranch:
    - master
    - main
  gitSuffix: True # <- New Line
dirs:
  templates: ./templates
  static: ./static
meta:
  title: git good
  description: i think it's a skill issue
server:
  name: git.icyphox.sh
  host: 127.0.0.1
  port: 5555
icyphox commented 2 months ago

Any reason you can't have your reverse proxy of choice rewrite your paths with the .git suffix? Seems like a weird change to make in legit, since nothing is preventing you from having your bare repos have .git in the name on the filesystem.

wbrijesh commented 2 months ago

I hadn't thought of that, thanks