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

GHContent#content always returns master version #162

Closed
tilayealemu opened this issue Mar 5, 2015 · 3 comments
Closed

GHContent#content always returns master version #162

tilayealemu opened this issue Mar 5, 2015 · 3 comments

Comments

@tilayealemu
Copy link

GHContent#content always returns content from the master branch. Included sample code. Content 1 comes from master and 2 from the specified branch. Using github-api 1.62.

@Test
public void github_api_issue() throws Exception {
    String branch = "mybranch";
    GitHub github = GitHub.connectUsingPassword("myyser", "mypassword");
    GHRepository ghRepo = github.getRepository("myrepo");
    List<GHContent> contents = ghRepo.getDirectoryContent("myfolder", "heads/" + branch);
    for (GHContent content : contents) {
        String content1 = content.getContent();
        String content2 = ghRepo.getFileContent(content.getPath(), branch).getContent();
        System.out.println("Contents of " + content.getPath());
        System.out.println("Content1");
        System.out.println(content1);
        System.out.println("Content2");
        System.out.println(content2);
    }
}
@KostyaSha
Copy link
Contributor

Just pass "branch" without "heads/"?

@tilayealemu
Copy link
Author

I see the same problem.

kohsuke added a commit that referenced this issue Mar 22, 2015
@kohsuke
Copy link
Collaborator

kohsuke commented Mar 22, 2015

Fixed.

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

3 participants