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

Get commit SHA from branch is wrong #1102

Closed
michael-kokorin opened this issue Feb 10, 2016 · 4 comments
Closed

Get commit SHA from branch is wrong #1102

michael-kokorin opened this issue Feb 10, 2016 · 4 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone

Comments

@michael-kokorin
Copy link
Contributor

If I use the following code:

var commitSha = client.Repository.GetBranch(
                GetSetting(GitHubItSettingKeys.RepositoryOwner),
                GetSetting(GitHubItSettingKeys.RepositoryName),
                branchId)
                .Result.Commit.Sha;

            var sources = client.Repository.Content.GetArchive(
                GetSetting(GitHubItSettingKeys.RepositoryOwner),
                GetSetting(GitHubItSettingKeys.RepositoryName),
                ArchiveFormat.Zipball,
                commitSha)
                .Result;

and branchId is different from master then I always get sources from master branch.
This behavior started from version 0.16 and till now. Version 0.15 gets correct result

@ryangribble
Copy link
Contributor

Looks like that function inadvertently passes String.Empty rather than the reference parameter into the next call in the chain

https://github.com/octokit/octokit.net/blob/master/Octokit/Clients/RepositoryContentsClient.cs#L241

In the meantime you should be able to use the overload that takes an additional TimeSpan argument (pass in 60 minutes if you want the same behaviour as the overload you are wanting to use), to work around the issue.

@shiftkey
Copy link
Member

@ryangribble nice spot - yep, that's a bug

@shiftkey
Copy link
Member

Added the easy-fix label as I think this is good for someone new to contribute. I'd also like to see a unit test for this to verify that we're passing through the right value.

@shiftkey
Copy link
Member

Fixed by #1113

@nickfloyd nickfloyd added Status: Up for grabs Issues that are ready to be worked on by anyone and removed up-for-grabs labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone
Projects
None yet
Development

No branches or pull requests

4 participants