Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/review/git-codereview: doesn't set upstream to origin/master #9377

Open
mattn opened this issue Dec 18, 2014 · 20 comments
Open

x/review/git-codereview: doesn't set upstream to origin/master #9377

mattn opened this issue Dec 18, 2014 · 20 comments
Milestone

Comments

@mattn
Copy link
Member

mattn commented Dec 18, 2014

We need to set upstream to master like below.

$ git checkout -b fix-windows-readlink
$ vim foo.go
$ git change
git rev-parse --abbrev-ref fix-windows-readlink@{u}
error: No upstream branch found for 'fix-windows-readlink'
error: No upstream branch found for 'fix-windows-readlink'
fatal: ambiguous argument 'fix-windows-readlink@{u}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
fix-windows-readlink@{u}
git branch --set-upstream fix-windows-readlink origin/master
@mattn
Copy link
Member Author

mattn commented Dec 18, 2014

Ah, it seems git is bits old. So @{u} make an error on git 1.7 .
What version of git are supported?

@paranoiacblack
Copy link
Contributor

Hmm? [branch]@{upstream} is supported since git 1.7.0, which is almost 4 years old: https://github.com/git/git/blob/e923eaeb901ff056421b9007adcbbce271caa7b6/Documentation/RelNotes-1.7.0.txt#L104.

Based on the bug reports we've gotten over the last few days, regarding these, I'd say we probably support git 1.8+ and we plan to add support to the default git that comes with different OS, see #9283

@mattn
Copy link
Member Author

mattn commented Dec 18, 2014

really?

@paranoiacblack
Copy link
Contributor

Sorry, I was thrown off by your second comment. [branch]@{u} is supported since git 1.7.0. The problem is that git checkout -b doesn't set an upstream, you'd need to run git checkout -b [branch] --track origin/master if you are not creating branches with git review change. I'm not sure if git review change should try to correct this for you or not.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title review: doesn't set upstream to origin/master x/review: doesn't set upstream to origin/master Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-review label Apr 14, 2015
@mattn
Copy link
Member Author

mattn commented Aug 12, 2015

@gopherbot
Copy link

CL https://golang.org/cl/13600 mentions this issue.

@mikioh mikioh changed the title x/review: doesn't set upstream to origin/master x/review/git-codereview: doesn't set upstream to origin/master Aug 13, 2015
@hyangah
Copy link
Contributor

hyangah commented Aug 21, 2015

Strange that I had to revert cl/13600 to make it work on my windows (Windows7 Professional)

$ git sync
git rev-parse --abbrevi-ref 'master@{u}'
fatal: no such branch: ''master'

$ git --version
git version 2.5.0.windows.1

@hyangah
Copy link
Contributor

hyangah commented Aug 21, 2015

Is it because of git version difference? I am reopening this issue.

@hyangah hyangah reopened this Aug 21, 2015
@mattn
Copy link
Member Author

mattn commented Aug 23, 2015

I'm using git on cmd.exe. Are you using on bash or zsh on msys2?

@ChrisHines
Copy link
Contributor

I have the same experience as @hyangah. I have a fresh install of git on Windows.

C:\Go15\go>git --version
git version 2.5.0.windows.1

C:\Go15\go>git sync
git rev-parse --abbrev-ref 'master@{u}'
fatal: no such branch: ''master'

git-codereview: exit status 128

After removing the call to quoteOnWindows that was introduced in cl/13600 git sync completes without error.

I see the same behavior from both cmd.exe and Git Bash (msys).

@mattn
Copy link
Member Author

mattn commented Aug 25, 2015

Hmm, strange. I can't reproduce.

@mattn
Copy link
Member Author

mattn commented Aug 25, 2015

Ah, ooops. Sorry. It seems that I installed two version of git.

git version 1.9.5.msysgit.1
git version 2.5.0

1.9.5.msysgit.1 still have problem. I'll make CL for revert.

@mattn
Copy link
Member Author

mattn commented Aug 25, 2015

Or do you have any idea to support 1.9.5 on windows? for example, checking versions.

@adg
Copy link
Contributor

adg commented Aug 25, 2015

I think we're better off just requiring a newer version of Git.
I thought we already had a check for the git version in there, but I can't find it now.
I'll send a rollback CL.

@adg
Copy link
Contributor

adg commented Aug 25, 2015

@mattn
Copy link
Member Author

mattn commented Aug 25, 2015

Hmm, strange. I can reproduce this problem without my fix.

@mattn
Copy link
Member Author

mattn commented Aug 25, 2015

with my fix

@ChrisHines
Copy link
Contributor

That is curious. I get a slightly different version string:

$ git version
git version 2.5.0.windows.1

I wonder if that is significant. I downloaded Git from http://git-scm.com/download/win.

@mattn
Copy link
Member Author

mattn commented Aug 28, 2015

I installed git from msys2 with following.

$ pacman -S git

@mattn
Copy link
Member Author

mattn commented Nov 10, 2015

How about to escape like below?

argv := []string{"git", "rev-parse", "--abbrev-ref", b.Name + "@\\{u\\}"}

@hyangah @ChrisHines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants