Jonathan Berkeley 01376d4926 git_hosting_providers: Add Gitiles provider (#63996)
Add Gitiles support to git hosting providers, to enable permalink / git
blame diff link features working for repositories browsed with Gitiles
(used by Gerrit).

Permalinks use the Gitiles URL format:
{base_url}/{repo}/+/{sha}/{path}#{line}

Configured via git_hosting_providers setting:

  { "provider": "gitiles", "name": "...", "base_url": "https://..." }

# Objective

- Add basic permalink + git blame linking support for another common Git
provider (Gerrit + Gitiles).

Gerrit/Gitiles is a self hosted setup used at several large
corporations, so it would be nice to have native support for it
alongside the other git hosting providers. It is relevant to many
people.

URL can vary substantially between different self hosted setups. URL can
be like https://gerrit.example.com or something more elaborate like
https://vcs.internal.example.com/plugins/gitiles.

This does not implement avatars or PR links (as the similar Chromium
provider does) since exact Gerrit setup (e.g. trailers used, avatars
used) can differ significantly between different self hosted instances.

It implements the fundamental Gitiles link part instead which is still
very useful, and is reliable; `base_url` can be set to the gitiles "Git
repositories on [instance]" [base
page](https://gerrit.googlesource.com/), and this integration will then
work.

## Solution

- Implements a new GitHostingProvider which constructs Gitiles format
permalinks based on the user config.

Implementation follows inspiration from other providers: Tangled /
Chromium (also Gitiles/Gerrit based but tied specifically to Chromium).

## Testing

- Unit tests cover the logic in this change.
- Built for Windows, performed exploratory testing (adding multiple
providers, different base_urls, trying a self hosted Gerrit instance vs
googlesource, git blame link through UI works, copy permalink via
right-click context menu in code works).

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments -> N/A
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines) -> N/A
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

#### "Copy permalink to line"
<img width="1958" height="677" alt="image"
src="https://github.com/user-attachments/assets/802a02af-db4e-4b9c-a7d5-ac26dc52cd7e"
/>

Above results in clipboard being set to:

https://gerrit.googlesource.com/gitiles/+/77d36f6ff5f50316daa82c6753af2c3217859df4/java/com/google/gitiles/GitilesUrls.java#34

#### Git blame diff view links to remote Gitiles view for the commit:
<img width="2242" height="808" alt="image"
src="https://github.com/user-attachments/assets/2792397a-83ae-4294-ae61-5a631975950d"
/>

Above example opens this link in browser:

https://gerrit.googlesource.com/gitiles/+/67c7844b7f7f228229c037cf297296874f50692c

---
`settings.json` for showcase example:
```json
  "git_hosting_providers": [
    {
      "provider": "gitiles",
      "name": "Gerrit Googlesource",
      "base_url": "https://gerrit.googlesource.com"
    }
  ],
```
---

Release Notes:

- Added `gitiles` as a Git hosting provider for Gitiles/Gerrit
deployments, enabling permalinks and navigation from git blame diff
view.

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 03:43:01 +00:00
…
…
…
…
…
…
…
…
…
…
…

Zed

Zed CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).

Other platforms are not yet available:

Developing Zed

Contributing

See CONTRIBUTING.md for ways you can contribute to Zed.

Also... we're hiring! Check out our jobs page for open roles.

Licensing

Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.

License information for third party dependencies must be correctly provided for CI to pass.

We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:

  • Is it showing a no license specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.

Sponsorship

Zed is developed by Zed Industries, Inc., a for-profit company.

If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.

S
Description
No description provided
Readme 1.7 GiB
Languages
Rust 95.4%
JSON-with-Comments 2.4%
Python 0.8%
Inno Setup 0.3%
Tree-sitter Query 0.3%
Other 0.4%