#7736 Add Redirects for cgit URLs
Closed: Fixed 2 months ago by kevin. Opened 2 months ago by jorton.

If you're going to kill cgit permanently can you add Redirects for all the URLs which we've used referencing it which litter bugzilla history?

e.g. https://src.fedoraproject.org/cgit/rpms/httpd.git/commit/?id=dbcbdf8a7373333db3b7d887ebf49744a1b409e2

-> https://src.fedoraproject.org/rpms/httpd/c/dbcbdf8a7373333db3b7d887ebf49744a1b409e2

if this is httpd and you have mod_rewrite enabled something like...

RewriteCond %{QUERY_STRING} ^id=(\w+)$
RewriteRule ^/cgit/rpms/(\w+).git/commit/ /rpms/$1/c/%1?

to handle the commit URLs at least. (untested)

Metadata Update from @smooge:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: src.fp.o

2 months ago

I'm open to some simple redirects.

However, I do want to avoid what happened when we retired gitweb. People asked us to redirect everything and we had a vast and incomprehensible pile of redirects that broke other things when you touched it.

So, yes, lets add a few simple ones in, but without any promise to keep every url ever working.

Metadata Update from @mizdebsk:
- Issue assigned to mizdebsk
- Issue tagged with: unfreeze

2 months ago

Implemented in dde66eb.
For now redirects are deployed only in staging environment due to Fedora 30 final freeze. Production deployment can happen after Fedora 30 release.
Please test in staging and let me know if something doesn't work as expected.

I tried to implement redirects for the following kinds of URLs, more ideas are welcome.

Awesome, thanks @mizdebsk

Trawling my mail archive the other form I see are /tree/ links like https://src.fedoraproject.org/cgit/rpms/httpd.git/tree/httpd.spec
-> https://src.fedoraproject.org/rpms/httpd/blob/master/f/httpd.spec

RewriteRule ^/cgit/([-._+a-zA-Z0-9/]+)\.git/tree/(.*) /$1/blob/master/f/$2 [R,L]

Added in 6fb16a4
Note that I used HEAD instead of master branch, as master is not the default branch in all repos.

Since we are now out of freeze, I have pushed this live. Thanks!

If you see any further adjustments to make, please file a new ticket. Thanks!

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 months ago

Login to comment on this ticket.