Skip to content

Need git show for single file. #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
twcrone opened this issue Jul 31, 2014 · 1 comment
Closed

Need git show for single file. #164

twcrone opened this issue Jul 31, 2014 · 1 comment
Assignees
Milestone

Comments

@twcrone
Copy link

twcrone commented Jul 31, 2014

I've added this hack to my project to return the text of a single file at a given SHA. I didn't see an easy way to do it without directing sending a message to Lib.command. I'd like to use something existing in ruby-git or make a PR for this feature. What do you think?

    def revision sha_ref
      # just until we can get a proper git.show(sha, path) pulled into Git gem.
      @git.lib.send(:command, 'show', ["#{sha_ref}:#{file_path}"])
    end
@robertodecurnex robertodecurnex added this to the 1.2.9 milestone Dec 3, 2014
@robertodecurnex robertodecurnex self-assigned this Dec 3, 2014
@robertodecurnex
Copy link
Contributor

Git.open('.').show('object_reference', 'file/path')

Will make the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants