Community
Participate
Working Groups
resolve() tries to parse the input string "refs/heads/foo-gbed2" as though it was the output of git describe. If bed2 isn't a unique object abbreviation in this repository, resolve() crashes. If it is unique, resolve() may be returning incorrect results and return the object that starts with bed2 and *not* the current value of the branch named foo-gbed2. Gerrit Code Review ran into this because it passed a branch name such as above into RemoteRefUpdate()'s constructor, which only accepts a String and passes its input down into resolve() to convert it to an ObjectId. Two things should happen with this bug: - RemoteRefUpdate should support additional constructor patterns to take ObjectId and/or Ref so Gerrit Code Review can be more explicit about its request and avoid the ambiguous parsing that resolve() may be doing. - resolve() should be more careful about its decision to use the -g `git describe` style variant when parsing. If the input starts with "refs/" it should never use the -g suffix rule. If the -g suffix isn't all hex (e.g. "foo-gbed2-dev") it also shouldn't use the -g suffix rule.
I have a proposed set of fixes for this, will upload for review in a few minutes.
Changes posted: http://egit.eclipse.org/r/2637 http://egit.eclipse.org/r/2638