{"action":"closed","issue":{"url":"https://api.github.com/repos/ruby-git/ruby-git/issues/296","repository_url":"https://api.github.com/repos/ruby-git/ruby-git","labels_url":"https://api.github.com/repos/ruby-git/ruby-git/issues/296/labels{/name}","comments_url":"https://api.github.com/repos/ruby-git/ruby-git/issues/296/comments","events_url":"https://api.github.com/repos/ruby-git/ruby-git/issues/296/events","html_url":"https://github.com/ruby-git/ruby-git/issues/296","id":160697650,"number":296,"title":"No way to determine the current branch the working directory is on?","user":{"login":"theirishpenguin","id":39653,"avatar_url":"https://avatars1.githubusercontent.com/u/39653?v=4","gravatar_id":"","url":"https://api.github.com/users/theirishpenguin","html_url":"https://github.com/theirishpenguin","followers_url":"https://api.github.com/users/theirishpenguin/followers","following_url":"https://api.github.com/users/theirishpenguin/following{/other_user}","gists_url":"https://api.github.com/users/theirishpenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/theirishpenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theirishpenguin/subscriptions","organizations_url":"https://api.github.com/users/theirishpenguin/orgs","repos_url":"https://api.github.com/users/theirishpenguin/repos","events_url":"https://api.github.com/users/theirishpenguin/events{/privacy}","received_events_url":"https://api.github.com/users/theirishpenguin/received_events","type":"User","site_admin":false},"labels":[{"id":886740737,"url":"https://api.github.com/repos/ruby-git/ruby-git/labels/wontfix","name":"wontfix","color":"ffffff","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-06-16T15:57:42Z","updated_at":"2018-04-09T01:57:32Z","closed_at":"2018-04-09T01:57:32Z","author_association":"NONE","body":"I might have missed an obvious way to list the current branch in the readme.\n\nAnyway, I have looked at...\n\nhttps://github.com/schacon/ruby-git/blob/master/lib/git/branch.rb#L95\n\n... but this returns a boolean, not a branch name.\n\nFor now I can workaround it with...\n\n```\nbranch_name = git.branch.instance_variable_get(:@base).lib.branches_all.select { |b| b[1] }.first[0] rescue nil\n```\n\n... whereas\n\n```\nbranch_name = git.branch.current\n```\n\nreturns false.\n\nI can see why, it is answering the question current? for a given branch name.\n\nBut how do I actually get the name of the current branch?\n"}}
{"actor":{"display_login":"stale"}}