2177: git branch is not used

maciek.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Sept. 23, 2011
What version are you running?
1.5.5

What's the URL of the page containing the problem?


What steps will reproduce the problem?
1. commit a change to non-master branch
2. open a review for the change, specify branch name
3. try to view the diff

What is the expected output? What do you see instead?
Instead of showing the diff applied to the specified branch, the diff is applied to the master branch, or failed to apply if the master branch and the branch that the diff came from have divered significantly

What operating system are you using? What browser?


Please provide any additional information below.
Although the review request contains branch field, it happens not to be used for fetching the file from raw file URL. The fields which can be passed are <revision> and <filename>. With this information, for instance cgit will output file from the default (master) branch.
Additional field <branch> could be used in raw file url. Hence the url for cgit would look like: http://servername/browse/gtk+/plain/<filename>?id2=<revision>&h=<branch>
david
#1 david
How are you creating the review request? Via post-review?

The "branch" field is just informational. It's not used in diff generation at all.
  • +NeedInfo
#2 maciek.********@gmai***** (Google Code) (Is this you? Claim this profile.)
I'm using the new review request webpage. The patch was created with git format-patch --full-index.
How can I submit a review for branch other than master?
#3 maciek.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Just to be clear, it's not only about posting a review, but also being able to see the diff (that's where raw file url comes into play).
I would really like to avoid creating a reviewboard repository for each project & branch (then I can easily pass a different raw file url with branch indicated correctly).
david
#4 david
In general we recommend using post-review to create review requests. The diff has to be against a revision which is present in the repository that reviewboard knows about. You can then use --parent with post-review (or format-patch against something other than master)
  • -NeedInfo
    +NotABug
#5 maciek.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Can you provide the parameters that I should use for git format-patch?
david
#6 david
git diff --full-index branch..HEAD

Which, again, assumes that 'branch' is present in the repo that reviewboard knows about. This is equivalent to `post-review --parent=branch`

Every diff has the revision of the file(s) that that particular diff was created from. format-patch will save one patch per commit between the selected revisions.
#7 maciek.********@gmai***** (Google Code) (Is this you? Claim this profile.)
I think I found source of the problem. The index line in git format-patch --full-index contains blobs rather than revisions. Then, the recommended cgit line:
http://git.gnome.org/browse/gtk+/plain/<filename>?id2=<revision> is incorrect as a commit sha is expected.
It needs to be updated to: http://git.gnome.org/browse/gtk+/blob/<filename>?id=<revision>

david
#8 david
  • -NotABug
    +New
  • +Component-Docs
david
#9 david
Fixed in master (feeddca). Thanks!
  • -New
    +Fixed