Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/admin/access-control/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ To edit the permissions granted to a role, click the role to expand it, then sel
You can read about the specific permission types available for each RBAC-enabled product area below:

- [Batch Changes](/admin/access-control/batch-changes)
- [Ownership](/admin/access-control/ownership)
- [Service accounts](/admin/service-accounts)

### Deleting a role
Expand Down
7 changes: 0 additions & 7 deletions docs/admin/access-control/ownership.mdx

This file was deleted.

1 change: 0 additions & 1 deletion docs/admin/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,5 @@ Sourcegraph administration is primarily managed by site administrators, who are
- [Configure search scopes](/code-search/working/snippets)
- [Integrate with Phabricator](/integration/phabricator)
- [Add organizations](/admin/organizations)
- [Add teams](/admin/teams) (Experimental)
- [Configuring rate limits](/admin/code-hosts/rate-limits)
- [Configuring command recording](/admin/repo/recording)
113 changes: 0 additions & 113 deletions docs/admin/teams.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,3 @@ docs/CODEOWNERS
```

Searches at specific commits will return any `CODEOWNERS` data that exists at that specific commit.

## Uploading a `CODEOWNERS` file to Sourcegraph

> Use this approach if you don't want to commit `CODEOWNERS` files to your repos, or if you have an existing system that tracks ownership data and want to sync that data with Sourcegraph.

Read more on how to [manually ingest `CODEOWNERS` data](/own/codeowners-ingestion) into your Sourcegraph instance.

The [docs](/own/codeowners-ingestion) detail how to use the UI or `src-cli` to upload `CODEOWNERS` files to Sourcegraph.
57 changes: 57 additions & 0 deletions docs/code-ownership/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Code ownership

Code ownership is aimed at helping find the right person and team to contact, for any question, at any time.

## Concepts

**Owner**: An owner is defined as a person in Sourcegraph.

A _person_ can be:

- a Sourcegraph user which we were able to resolve from the `CODEOWNERS` handle or email, in which case we link to their profile.
- an unknown user for which we were unable to resolve a profile, in which case we will return the `CODEOWNERS` data we have.

## Code ownership

Code ownership is set via [the `CODEOWNERS` format](/code-ownership/codeowners-format).

## Limitations

- The feature has not been fully validated to work well on large repositories or large `CODEOWNERS` rulesets. This is a future area of improvement, but please contact us if you run into issues.

## Browsing ownership

The ownership information is available for browsing once ownership data is available through [a `CODEOWNERS` file](#code-ownership).

When displaying a source file, there is an "Owernship" button at the bottom. Clicking it will open the "Owernship" panel.

![File view with the ownership tab selected in the bottom panel](https://storage.googleapis.com/sourcegraph-assets/docs/own/blob-view-panel-v2.png)

## Ownership search

### Searching for files with owners

Code ownership is a first-class citizen in search. Ownership can be either a query input or a search result:

- `file:has.owner(user@example.com)` keeps only the search results associated with given user (here referred to by e-mail).
- `-file:has.owner(@username)` removes all results owned by specific user (here referred to by name).

Ownership predicate can also be used without parameters:

-`file:has.owner()` will only include files with an owner assigned to them. -`-file:has.owner()` will only include files without an owner.

When performing a search the `select:file.owners` predicate will return the owners for the result of that search.

For instance one can find all the owners of TypeScript files in a given repository by using `repo:^github\.com/sourcegraph/sourcegraph$ lang:TypeScript select:file.owners`.

### Find commits in given release for given owner

To find all commits between versions `5.0` and `5.1` made by `sourcegraph/own` team, the following query could be used:

`repo:^github\.com/sourcegraph/sourcegraph$@5.1:^5.0 type:commit file:has.owner(sourcegraph/own)`

## Further reading

In order to learn more please check out our references:

- [CODEOWNERS format](/code-ownership/codeowners-format) - Guide to using the CODEOWNERS file format to define ownership
2 changes: 1 addition & 1 deletion docs/code-search/queries/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The following filters can be used on all searches (using [RE2 syntax](https://go
| **repo:has.commit.after(...)** | Filter out stale repositories that don't contain commits past the specified time frame. See [built-in predicates](/code-search/queries/language#built-in-repo-predicate) for more | [`repo:has.commit.after(yesterday)`](https://sourcegraph.com/search?q=context:global+repo:.*sourcegraph.*+repo:has.commit.after%28yesterday%29&patternType=keyword) <br /> [`repo:has.commit.after(june 25 2017)`](https://sourcegraph.com/search?q=context:global+repo:.*sourcegraph.*+repo:has.commit.after%28june+25+2017%29&patternType=keyword) |
| **rev:at.time(...)** | Search a repo or a branch at a specific point in time. | [`rev:at.time(1 year ago)`](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/sourcegraph/sourcegraph%24+rev:at.time%281+year+ago%29+&patternType=keyword&sm=0) <br /> [`rev:at.time(2021-01-01)`](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/sourcegraph/sourcegraph%24+rev:at.time%282021-01-01%2C+v5.0.0%29+&patternType=keyword) |
| **file:has.content(...)** | Conditionally search files only if they contain contents that match the provided regex pattern. See [built-in predicates](/code-search/queries/language#built-in-repo-predicate) for more | [`file:has.content(Copyright) Sourcegraph`](https://sourcegraph.com/search?q=context:global+file:has.content%28Copyright%29+Sourcegraph&patternType=keyword) |
| **file:has.owners(...)** | **Beta** Conditionally search files only if they are owned by the given owner. Empty means _any owner_. See [code ownership documentation](/own) for more | [`file:has.owner(alice@sourcegraph.com) Sourcegraph`](https://sourcegraph.com/search?q=context:global+file:has.owner%28alice@sourcegraph.com%29+Sourcegraph&patternType=keyword) |
| **file:has.owners(...)** | Conditionally search files only if they are owned by the given owner. Empty means _any owner_. See [code ownership documentation](/code-ownership) for more | [`file:has.owner(alice@sourcegraph.com) Sourcegraph`](https://sourcegraph.com/search?q=context:global+file:has.owner%28alice@sourcegraph.com%29+Sourcegraph&patternType=keyword) |
| **file:has.contributor(...)** | Conditionally search files only if a file contributor's name or email matches the provided regex pattern. See [built-in predicates](/code-search/queries/language#built-in-file-predicate) for more | [`file:has.contributor(alice@sourcegraph.com) Sourcegraph`](https://sourcegraph.com/search?q=context:global+file:has.owner%28alice@sourcegraph.com%29+Sourcegraph&patternType=keyword) |
| **count:_N_,< /> count:all** | Retrieve <em>N</em> results. By default, Sourcegraph stops searching early and returns if it finds a full page of results. This is desirable for most interactive searches. To wait for all results, use **count:all** | [`count:1000 function`](https://sourcegraph.com/search?q=count:1000+repo:sourcegraph/sourcegraph$+function) <br /> [`count:all err`](https://sourcegraph.com/search?q=repo:github.com/sourcegraph/sourcegraph+err+count:all&patternType=keyword) |
| **timeout:_go-duration-value_** | Customizes the timeout for searches. The value of the parameter is a string that can be parsed by the [Go time package's `ParseDuration`](https://golang.org/pkg/time/#ParseDuration) (e.g. 10s, 100ms). By default, the timeout is set to 10 seconds, and the search will optimize for returning results as soon as possible. The timeout value cannot be set longer than 1 minute. When provided, the search is given the full timeout to complete | [`repo:^github.com/sourcegraph timeout:15s func count:10000`](https://sourcegraph.com/search?q=repo:%5Egithub.com/sourcegraph/+timeout:15s+func+count:10000) |
Expand Down
Loading