Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • TortoiseGit TortoiseGit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 382
    • Issues 382
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • TortoiseGitTortoiseGit
  • TortoiseGitTortoiseGit
  • Issues
  • #3638
Closed
Open
Issue created Sep 11, 2020 by tchesftw@tchesftw

Better handling of trying to set an upstream branch not set to be fetched in the remote

What steps will reproduce the problem?

  1. Open the Browse References window in a repository where remote foo is not set to fetch the branch bar (i.e., the refspec in the remote.foo.fetch config option does not include the branch bar)
  2. Right-click a local branch baz and try to set its upstream branch to remotes/foo/bar
  3. The column Tracked branch of baz becomes blank

What is the expected output? What do you see instead?

Git considers this an invalid situation. If one tries to do that by running git branch "baz" --set-upstream-to="foo/bar", git will complain like this:

fatal: Cannot setup tracking information; starting point 'foo/bar' is not a branch.

The problem is that TortoiseGit sets the branch.baz.remote and branch.baz.merge directly, instead of calling git branch like shown above. When the Browse References window tries to refresh the list, it will call git for-each-branch, which will report a blank value or an otherwise invalid value for the upstream branch.

What version of TortoiseGit and Git are you using? On what operating system?

Development snapshot as of 2020-09-09. Git version 2.28.0.windows.1. Windows 10 x64.

Please provide any additional information below.

I've attached a patch which, instead of setting the config keys directly, calls git branch and errors out if necessary.

I leave this up for discussion whether it is better to, in this case, call git remote set-branches and then try to run git branch again, possibly warning the user about that, instead of erroring out and being done with it as I did in my patch.

invalidupstreamref.patch

Possibly related: #2239 (closed)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking