Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • SWIFTsim SWIFTsim
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 57
    • Issues 57
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 21
    • Merge requests 21
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • SWIFT
  • SWIFTsimSWIFTsim
  • Merge requests
  • !47

Ensure GIT_BRANCH non-empty when not on a branch

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Angus Lepper requested to merge git_branch into master Oct 16, 2015
  • Overview 3
  • Commits 2
  • Changes

If HEAD is detached e.g. during git bisect, GIT_BRANCH ends up empty, which causes an error at runtime. This change grabs the description from git branch, which is either the branch name or something like (HEAD detached at <hash>) on recent versions or (no branch) in older versions. Works with BSD and GNU sed, and git >= 1.0.0b (at least) although detached HEAD only introduced in 1.5.0.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: git_branch