diff --git a/CHANGELOG.md b/CHANGELOG.md index 57653f5..987f75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- URL templates in the git config (`gitweb..branch-template`, + `tag-template`, `commit-template` and `merge-request-template`) to open the + repositories of self-hosted forges like Bitbucket Server (#55) +- codeberg.org as a known host, with the URLs of Gitea + +### Changed + +- gitlab.com opens its own URLs (`/-/tree/`, `/-/commit/`) and gitea.com its + own (`/src/branch/`, `/src/tag/`) instead of the GitHub ones +- gitea.com is the known host of Gitea instead of gitea.io, which only + redirects to gitea.com +- the merge requests URLs no longer end with a slash, but on bitbucket.org + where it is the canonical URL + +### Fixed + +- a repository with `.git` in its name, like `user.github.io`, is no longer + opened as `userhub.io` +- `--merge-request` on an unknown host exits with the code 7 instead of + panicking + ## 0.5.0 - 2026-10-21 ### Added diff --git a/Cargo.lock b/Cargo.lock index b4bb668..daa05b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -325,6 +325,7 @@ dependencies = [ "git2", "log", "open", + "percent-encoding", "tempfile", "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index f3ed8d3..1640dbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ git-url-parse = "0.6" git2 = { version = "0.21", features = ["vendored-openssl"] } log = "0.4" open = "5.4" +percent-encoding = "2.3" thiserror = "2.0" [dev-dependencies] diff --git a/README.md b/README.md index e9b3650..7e42c0d 100644 --- a/README.md +++ b/README.md @@ -107,3 +107,74 @@ custom branch or tag you want to open in the browser. `gitweb` will open the origin remote if it exists. You can override the behavior by giving the `--remote` flag with the custom remote you want to open. + +The remote is the name of one of the git remotes of the repository (`git remote` +lists them, usually `origin`, and `upstream` when working on a fork). It does +not change the shape of the URL that is opened, see [Custom URLs](#custom-urls) +for that. + +## Custom URLs + +`gitweb` knows the URLs of github.com, gitlab.com, bitbucket.org, gitea.com and +codeberg.org, and opens GitHub-like URLs for every other host (except for the +merge requests, which need a template). For a self-hosted forge with other URLs, set +URL templates for its host in your git config: + +```shell +git config --global gitweb..branch-template '