golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.38k stars 17.71k forks source link

x/review/git-codereview: can't run git change #9408

Open bradfitz opened 9 years ago

bradfitz commented 9 years ago

git-codereview is confused and thinks I'm on some other branch:

ba12:oauth2 bradfitz$ go get -u -v golang.org/x/review/git-codereview
Fetching https://golang.org/x/review/git-codereview?go-get=1
Parsing meta tags from https://golang.org/x/review/git-codereview?go-get=1 (status code 200)
get "golang.org/x/review/git-codereview": found meta tag main.metaImport{Prefix:"golang.org/x/review", VCS:"git", RepoRoot:"https://go.googlesource.com/review"} at https://golang.org/x/review/git-codereview?go-get=1
get "golang.org/x/review/git-codereview": verifying non-authoritative meta tag
Fetching https://golang.org/x/review?go-get=1
Parsing meta tags from https://golang.org/x/review?go-get=1 (status code 200)
golang.org/x/review (download)

ba12:oauth2 bradfitz$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 12 commits.
#   (use "git push" to publish your local commits)
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   transport.go
#

ba12:oauth2 bradfitz$ git branch
* master

ba12:oauth2 bradfitz$ git diff --cached
diff --git a/transport.go b/transport.go
index 9e7b106..10339a0 100644
--- a/transport.go
+++ b/transport.go
@@ -62,7 +62,7 @@ func (t *Transport) CancelRequest(req *http.Request) {
        type canceler interface {
                CancelRequest(*http.Request)
        }
-       if cr, ok := t.Base.(canceler); ok {
+       if cr, ok := t.base().(canceler); ok {
                t.mu.Lock()
                modReq := t.modReq[req]
                delete(t.modReq, req)

ba12:oauth2 bradfitz$ git codereview change nilbase
git-codereview: cannot branch from work branch; change back to master first.

ba12:oauth2 bradfitz$ git branch
* master

/cc @adg @rsc

bradfitz commented 9 years ago

The clue is in Your branch is ahead of 'origin/master' by 12 commits, but the codereview tool gives a very misleading error message (change back to master first).