Bug 413796 - Git plugin does not populate branch when detecting changes
Summary: Git plugin does not populate branch when detecting changes
Status: NEW
Alias: None
Product: Hudson
Classification: Technology
Component: GIT (show other bugs)
Version: 3.1.0   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Winston Prakash CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-26 06:04 EDT by Alex Blewitt CLA
Modified: 2013-07-26 06:04 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Blewitt CLA 2013-07-26 06:04:28 EDT
The git plugin allows you to monitor any branch using

  branch specifier (leave blank for default): **

When a change occurs on a branch the log says

  Commencing build with revision abcd1234 (origin/master)
  Checking out abcd1234 (origin/master)

however in the job configuration the environment variable $GIT_COMMIT has the value abcd1234 but $GIT_BRANCH is not set, and so there's no way of knowing that it's building the upstream master branch.

It would be useful to set the origin/master as $GIT_BRANCH since this may be semantically interesting over and above the hash itself (i.e. am I building the 'qa' or 'production' branch).

It would also be useful to expose the upstream branch name e.g. $GIT_UPSTREAM_BRANCH as the prefix 'origin/' is something set in the job description itself so the text 'origin/' cannot be assumed. In this case, the $GIT_UPSTREAM_BRANCH would have just 'master'.