I have a strange issue in my repo, when I search for i.e. "DEM"
Steps:
Open https://github.com/limex/schotterosm-cartocss-style/search?q=DEM
Expected Result:
4 Search Results. i.e. for the readme.md, as you can clearly see on the page https://github.com/limex/schotterosm-cartocss-style
Observed Result:
0 Results
I don't get any results for code searches within my repo.
Funfact:
My repo is a fork and the same search works on the original repo:
https://github.com/cyclosm/cyclosm-cartocss-style/search?q=DEM
Any idea why?
BR Günther
I think you repository is still being indexed. I also get that notification with the new search experience:
Related
My objective is to count the number of repositories that use PyTorch. Therefore, I came up with the following code, using the THUNDER CLIENT extension in VS Code -
https://api.github.com/search/repositories?q=language:python + readme:PyTorch
However, this gives me just 7 search results. I am confident the result should be in the range of thousands. Could someone suggest where I am going wrong?
The GitHub search API for repositories checks the name, description and the README of all repositories.
Therefore, all that was needed to be done was -
https://api.github.com/search/repositories?q=PyTorch
I am setting everything according to the docs. Why is the app returning the error at the bottom of the dialog below 'Save'? The repo exists!
EDIT
The api server log reports that it's trying to run a query on the options.url on the collector items collection, but the collection item doesn't have this field set up:
2022-11-14 05:11:31,089 [http-nio-8080-exec-6] DEBUG o.s.data.mongodb.core.MongoDbUtils - Getting Mongo Database name=[dashboarddb]
2022-11-14 05:11:31,107 [http-nio-8080-exec-6] INFO c.c.d.a.t.JwtAuthenticationFilter - correlation_id=NULL application=hygieia, service=api, requester=admin, duration=135, uri=/api/collector/item/type/searchField/scm, request_method=GET, status=200, client_ip=127.0.0.1, x-forwarded-for=null, request_params=search:[https://github.com/githubtraining/hellogitworld.git],searchField:[options.url],size:[20]
I spent a lot of time investigating. I was able to work around the issue by adding manually the repo url and branch to the collector_items entry for GitHub/SCM in the dashboarddb mongodb. The submit() function in the UI is not working correctly. The field is not in url.options.url because url contains the string. Finally, the dashboardId is set wrongly on the collector_items. It pointed to Product while it should have pointed to SCM collector.
I know I can exclude one author by -author:someone, but it looks like excluding 2 authors doesn't work: -author:user1 -author:user2. The result will include the user2.
I read GitHub search syntax doc but could find a solution.
Is there a way to exclude 2 authors at the same time?
I don't seem to be facing the same issue as you for some reason. I tried searching "rust" in:name, to show all repos matching the exact phrase "rust", which gave me the following results (you can view them on GitHub here):
screenshot of searching "rust" in:name on GitHub
I then searched "rust" in:name -user:rust-lang -user:TheAlgorithms -user:tensorflow (view them on GitHub here) to exclude the first 3 authors from the results, which worked a charm:
screenshot of searching "rust" in:name -user:rust-lang -user:TheAlgorithms -user:tensorflow on GitHub
Short version
When I compare two forks on Github, it does not compare the latest states, but the current state of the base fork with the last common commit (or am I wrong?); so how can I compare the latest states/heads on Github?
Longer version
I am trying to compare two repositories on Github.
It does not seem to compare the latest states of both repository. Instead, it compares:
the base fork as it was when both repositories where identical (last common commit?)
with
the head fork as it is now.
You can see this in the Github's fork comparison example, it says there are no changes between those two repositories, but there are now very different.
How can I compare the latest states/heads on Github?
https://github.com/github/linguist/compare/master...gjtorikian:master
github:master is up to date with all commits from gjtorikian:master.
Try switching the base for your comparison.
It means that all commits from gjtorikian/liguist are part of github/linguist.
The reverse is not true:
https://github.com/gjtorikian/linguist/compare/master...github:master
That would give all (1866) commits from github/linguist which are not part of gjtorikian/linkguist.
This is triple-dot '...' diff between the common ancestor of two branches and the second branch (see "What are the differences between double-dot “..” and triple-dot “…” in Git diff commit ranges?"):
In the first case github/linguist:master...gjtorikian/linguist:master, the common ancestor and gjtorikian/linguist:master are the same! O commits.
In the second case gjtorikian/linguist:master...github/linguist:master, github/linguist:master has 1866 commits since the common ancestor (here, since gjtorikian/linguist:master).
As a side note, the compare of forks can be reached from the compare page.
Say your project is Zipios:
https://github.com/Zipios/Zipios
What you want to do is add the .../compare to that URL:
https://github.com/Zipios/Zipios/compare
On that page, you can select two branches but if you look closely, at the top there is a link that says: compare across forks.
Once you clicked on that link, it shows you two extra dropdowns with your main branch and the list of forks.
What I have yet to discover is how to go from the main page of a project to the Compare page. Maybe someone could shed light on that part?
From #somerandomdev49:
To go to the compare page, go to the "Pull Requests" tab and click the "Create Pull Request" button.
I was just wondering if it's possible to count the total number of empty repositories on GitHub.
If not for all users, can it be done for yourself?
Edit
I have tried the size:0 search, but it seems to return a lot of repositories which do contain data. Taking something like size:0..1 didn't help either.
If I try searching for the keyword empty, but it doesn't cover all aspects.
Update
I got a response from Brian Levine (GitHub)
That would be an interesting statistic. We don't have a simple way to do that right now. However, you might be able to use the GitHub API to get close. You could look through public repositories and compare "pushed_at" and "created_at" dates to see if there has been any activity. Additionally, you could find repositories with a "size" of 0. There's more information on how to find this information, and much more, right here:
http://developer.github.com/v3/repos/
You could:
list all public repos through the API, and,
for each repo, check the ones with a size equals to 0.
(The size seems to be in KB)
GET /repos/:owner/:repo
Note that an "empty" repo could still have at least one commit, when created with the default README.md description file.
Actually, as the OP Aniket comments:
I explained the meaning of empty as: 0-1 commits, max 3 files:
.gitignore
README.md
LICENSE
(Note: README is different from README.md)
Another way is, for each repo, to look at the number of commits.
0 or 1 commit means probably an empty repo.
Update: GitHub confirms there is no current way to determine if a repo is "empty".
The closest way to do that would be:
You could look through public repositories and compare "pushed_at" and "created_at" dates to see if there has been any activity
To check if a repository is empty, look to see if it has any commits.
https://api.github.com/repos/:owner/:repo/commits?per_page=1
An empty repository will have a non-successful HTTP status and the content...
{
"message": "Git Repository is empty.",
"documentation_url": "https://developer.github.com/v3"
}
If it doesn't exist, you'll get a 404 and...
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}
If it does exist, you'll get an HTTP 200 and one commit.
Using the attribute "size" from the API will not help as mentioned by other posters here.
An example is this repository:
https://api.github.com/repos/errfree/test
If you note, it displays the size as 48 despite being empty.
Disclaimer: This approach is a hack. It is not efficient nor officially supported by GitHub, but works good enough for me.
Basically, I download the Zip version of the repository. When the repository is empty then it will not return a zip file but provides as result an HTML page saying "This repository is empty.".
After downloading a zip file, I verify if the size is smaller than 30Kb and if this is the case, I look inside the file contents for the string "This repository is empty." to confirm that a given repository is empty.
Here is a practical example of direct zip download that on this case will display an empty page:
https://github.com/errfree/test/zipball/master/
My pseudo-code in Java:
// we might have reached an empty repository
if(fileZip.length() < 30000){
// read the contents
final String content = utils.files.readAsString(fileZip);
// is this an HTML file with the repository empty message?
if(content.contains("This repository is empty.")){
return null;
}
}
Hope this helps.