Skip to content

show upstream remote (if found) in repository settings #6877

Open

Description

@shiftkey

Please describe the problem you think should be solved

When adding a GitHub repository that's a fork (identified via the API), Desktop will add an upstream remote if needed:

private async addUpstreamRemoteIfNeeded(repository: Repository) {
const gitStore = this.gitStoreCache.get(repository)
const ignored = await this.getIgnoreExistingUpstreamRemote(repository)
if (ignored) {
return
}
return gitStore.addUpstreamRemoteIfNeeded()
}

The context for this change is #3199 and #2364, which has been built upon to help support fork workflows like merging in changes from the upstream project.

However there's no place in the Repository Settings UI where we show this value. We only show the "primary remote URL" here:

export class Remote extends React.Component<IRemoteProps, {}> {
public render() {
const remote = this.props.remote
return (
<DialogContent>
<div>Primary remote repository ({remote.name})</div>
<TextBox
placeholder="Remote URL"
value={remote.url}
onValueChanged={this.props.onRemoteUrlChanged}
/>
</DialogContent>
)
}
}

While this is a relatively minor thing, I think the app could do better here and show this value because it's a change to the repository that the application introduced.

[Optional] Do you have any potential solutions in mind?

If:

  • this is a valid GitHub repository
  • it's marked as a fork when we query the GitHub API
  • it has the upstream remote set

We should show this value in the settings dialog. It should be readonly to prevent accidentally changing the value and breaking the app (I think we could also do this for all GitHub repositories but that's out of scope for this discussion).

Activity

  1. borpin commented on Feb 19, 2019

    @borpin

    When adding a GitHub repository that's a fork (identified via the API), Desktop will add an upstream remote if needed:

    Key words are "When adding". These repositories I have, have been added a while ago. Could a check be made, when opening the repository, for an upstream?

    We should show this value in the settings dialog. It should be readonly to prevent accidentally changing the value and breaking the app

    Yes if you either do a check, or if you provide the means to force a check (legacy).

    Of course you can add an upstream manually through the CLI.

  2. wolftales commented on Apr 9, 2020

    @wolftales

    Of course you can add an upstream manually through the CLI.

    I tried opening up the CLI and got this error:

    C:\Users\wolft\OneDrive\Documents\GitHub\tiny_python_projects>git remote add upstream https://github.com/kyclark/tiny_python_projects.git
    fatal: remote upstream already exists.

    I checked repo settings and as listed by this bug, it isn't shown.

    If I'm following the bugs - the remote upstream is there somewhere, but hidden. Which would mean the command I ran was adding a duplicate which resulted in the error.

    I'm adding a forked repo within GitHub Desktop to track a code repo for a book in development (meaning I anticipate updates and changes).

    Sounds like everything might be fine, but I vote for something to help build confidence this is working properly.

    I found this command to verify on CLI to confirm everything is configured as it should be:

    C:\Users\wolft\OneDrive\Documents\GitHub\tiny_python_projects>git remote -v
    origin https://github.com/wolftales/tiny_python_projects.git (fetch)
    origin https://github.com/wolftales/tiny_python_projects.git (push)
    upstream https://github.com/kyclark/tiny_python_projects.git (fetch)
    upstream https://github.com/kyclark/tiny_python_projects.git (push)

  3. added
    not-planned
    on Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementnot-planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions