Skip to content

FR: Honor remote refspec definitions when fetching from git colocated workspaces #5323

@ipetkov

Description

@ipetkov

Is your feature request related to a problem? Please describe.
Running jj git fetch will fetch all branches (and maybe tags?) of a remote repo, even if git fetch origin wouldn't (due to refspec definitions for the remote)

Describe the solution you'd like
It would be really nice if jj git fetch would honor the refspec definitions for the remote server (instead of fetching the entire repo) if they are present.

Alternatively I'd also settle for jj specific configuration to define equivalent behavior

Describe alternatives you've considered
As an alternative I've been getting by with running git fetch origin && jj git import which does the trick, but it would be nice to not have to remember to not run jj git fetch

Additional context
I work on a monorepo that gets a lot of traffic (tons of tags and branches that are being worked on). Generally speaking each developer working in this monorepo will push their branches behind a specific prefix so that we can judiciously filter out what is fetched by default by git. For example I have the following definition in .git/config:

[remote "origin"]
  fetch = +refs/heads/main:refs/remotes/origin/main
  fetch = +refs/heads/ivan/*:refs/remotes/origin/ivan/*
  tagOpt = --no-tags

That way by default, I'll only fetch and track the main branch as well as my own branches. (If I need to check out someone else's branch I do that with git fetch origin someone/their-branch && git checkout FETCH_HEAD but this functionality is out of scope for this feature request)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions