Skip to content
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

Not able to get the right file content #371

Closed
vaibhavsw opened this issue Aug 16, 2017 · 1 comment
Closed

Not able to get the right file content #371

vaibhavsw opened this issue Aug 16, 2017 · 1 comment

Comments

@vaibhavsw
Copy link

I have a use case in which I get a commit id for a particular branch in a repository, but when I try to get the file content from that particular branch, I get the content for the same file from the master branch.

How to get a branch and get the file content from that branch only. Also, is it possible to get the branch and file content on the basis of commit id. Below is my code I use to get the file content

`

    GHContent props = null;
    try {
        props = ghBranch.getOwner().getFileContent("props.json");
    } catch (IOException e) {
        return Response.badRequest("Cannot find props.json at the root of project");
    }

    CustomProps props = convertorService.getProperties(props);
    return Response.ok(cloud);`
@bitwiseman
Copy link
Member

How about this:

    props = ghRepository.getFileContent("props.json", sha);

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