Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub API questions #94
Comments
This comment has been minimized.
This comment has been minimized.
deltab
commented
Sep 14, 2018
|
This comment has been minimized.
This comment has been minimized.
|
First, thanks for the answers to both of the queries. To the first one, your first call definitely returns a list of all the files in the repo. But I'm not familiar with the term HEAD. I assume that must come from the GIT world? What does it mean? Is it documented somewhere? I'm happy to read, and scratch my head. I have a feeling if I understood that nomenclature I'd do a lot better with their API. ;-) Thanks again. |
This comment has been minimized.
This comment has been minimized.
rosskarchner
commented
Sep 14, 2018
|
I think you can understand I've been using git for years, and still found these episodes of All Things Git helpful: https://www.allthingsgit.com/episodes/branching_and_merging_part_1.html |
This comment has been minimized.
This comment has been minimized.
|
I need to explain what the app is, because it actually isn't about GIT, it's about a repo being used to host a blog. I want a way to get a list of all the editable files in the repository, so I can present them to the user in the equivalent of an open file dialog. So if HEAD is an okay way to do that, then I'll use that. Assume that there are never any branches in the project. The repository is functioning like a file system. I'm also okay with using the code I have that does its own recursive traversal of the repo. It turns out to be fast enough, even with a pretty active blog over a bit of time. |
This comment has been minimized.
This comment has been minimized.
deltab
commented
Sep 14, 2018
Using git's terminology, there's always at least one 'branch' in a repo; it's called You can use the branch name in URLs, and it's probably better to do so: GitHub rate-limits API requests, so it's better to reduce the number sent when you can. (Also, why do more than you need to?) |
scripting commentedSep 11, 2018
•
edited
TL;DR -- How to find the root of a repo for the tree api, and are the content and tree APIs deprecated as of Oct 1?
I'm using the contents API to do a traversal of the directory structure of a repository. It works. Here's a gist containing the code. It takes about three seconds to traverse the structure of my test1 repo. I'm thinking about using the tree API, hoping that it will be considerably faster. But I can't figure out how to get the sha for the root of the repo. Any suggestions much appreciated.
There are notes on the GitHub API website about GitHub Services being deprecated starting October 1. At first I thought this applied to the API I'm using. Now I'm wondering. I'm just using the contents API. Is this part of the deprecated set? If so arrrrgh. And where can I find good sample code for getting and setting the contents of a file and doing a directory traversal.