There are SO many times I need a short peek at something, and am glad don't have to clone/download, etc.
There are SO many times I need a short peek at something, and am glad don't have to clone/download, etc.
The source browsing feels barely adequate to me. There are so many simple things they could do to make it better.
• Show file sizes. When I'm exploring a repo I'm unfamiliar with, one thing that's helpful for me is to get a sense of what the code is like. To do this, I want to look at some of the larger files; that's where I'll probably find the more interesting code. As it is I just click around on random files hoping to find something interesting.
• Show real dates instead of the vaguely rounded off "how long ago". If it says "a month ago", well, what is it, two weeks or six? And why not show the time? A couple of times I've been looking for a code change and I didn't remember what day it was but I did remember it was right before lunch, maybe around 11:30 or so. It feels like their priority is a "clean and simple" display as opposed to a useful and informative display.
• Fix the display for code that indents with tabs. It still defaults to 8 columns, which hardly anyone (with a few notable exceptions) likes. And you, the user, can't override this. They did recently start honoring the indent_size setting if you have a .editorconfig file, but that really misses the point. Many of us who use tabs don't want to specify an indent_size. That's one of the virtues of tabs: people who read the code can use whatever indentation they prefer. The indent size for tabs should be a user preference setting. As it is, I started adding indent_size=4 to my .editorconfig files just to get a decent looking display on GitHub.
• Use a readable font on mobile. Courier, really? And not such low contrast! Everything is hard to read on mobile, and they even disabled pinch-zoom so I can't make the text a little bigger.
• Show a directory tree on the left. If I'm exploring a repo, I'd like to get the big picture of the directory layout, and also have an easy way to click around to look at the various directories. As it is, I have to do a lot of back and forth. Google Code had this from the beginning.
Edit: Thank you everyone for the helpful replies! I learned some great tips from you all.
Hidden feature: you can actually add ?ts=2 (or 4) to the URL. It would be nice to be able to configure it, though.
https://userstyles.org/styles/70979/github-better-sized-tabs...
Those are at the top of the display of file contents. However, they aren't in the tree view, as you've stated. Unfortunately, this is hard because I don't believe Git stores this info in their index of files, which is what is used to generate the tree view. It might be infeasible to gather that data for the tree view.
> Show real dates instead of the vaguely rounded off "how long ago".
If you hover over any relative date, the real date is shown. It's on the title attribute for any relative date.
> Use a readable font on mobile.
The have Consolas and "Liberation Mono" on the font stack, but those probably aren't on your phone. They are limited in font selection because they have switched to native fonts. This avoids the download of some giant font file that contains all the possible glyphs (which is needed on a site like GitHub's). Unfortunately, the monospace options on mobile are pretty limited: http://iosfonts.com/
> Show a directory tree on the left.
Best tip I can offer is to type `t` to search by file name. Works great and has partial matching support, which makes it really quick to navigate to certain key files.
What i found:
t = search file
j/k = move down/down (selected file)
w = select branch
s = focus search field
y = expands url
Anyone know any more?
EDIT: Found this https://help.github.com/articles/using-keyboard-shortcuts/
I'm guessing I should be slightly embarrassed to have not realised that existed - was it there before they changed the top bar to black a few days ago? (I now see that there's a link to it from said bar...)
I don't know if they keep a work tree on the server side, but if they did, then it would be trivial to store the file size as determined from the file on disk and display it on the front-end regardless of the type of view. Alternatively, they could determine the size from the blob associated with the file in the object store.
That's complicated by the fact you could be viewing any commit, not just HEAD of master.
git cat-file -s commit:path/to/file
and the tree object has a listing of the blobs and trees it references. I would think they could do this and store the results when a particular commit is chosen from the drop-down menu on the web page.It's already doing this for the last time modified value it retrieves or calculates for each file and directory as I'm browsing through the repo. That requires determining which commit last changed each file and in the case of directories, which commit most recently changed one of the files within the directory.
The file sizes, on the other hand, are available by determining which blob is associated with the file. That file to blob mapping available by recursing through the trees associated with the commit that's currently selected. This does not require iterating through multiple commits, unlike the former case, and it shouldn't be any more complex.
>>> import zlib
>>> f = open('.git/objects/00/331d4c2e12984f70df4a3dd3bc7296825faab0', 'rb')
>>> zlib.decompressobj().decompress(f.read(100))
b'blob 11708\x00...'
So that particular file is 11708 bytes. It still requires an open and read operation. But they could cache that on a per-file or per-tree basis, so it's very doable.The OctoTree extension is great for this (all browsers, and works for both Github and Gitlab)
Features
1. Displays repo size.
2. Displays each file size in every active branch (not applicable for folder / symlink).
3. Show download link for each individual file (not applicable for folder / symlink).
4. Copy file's contents directly to Clipboard (just won't work for markdown files).
5. Download file while viewing it's contents.
[1] https://github.com/softvar/github-plus
[2] https://chrome.google.com/webstore/detail/github-plus/anlikc...
FYI there's a Chrome extension for that
https://chrome.google.com/webstore/detail/octotree/bkhaagjah...
God made the ASR-33 with 8-column tabs for a reason. ;-)
As for style, it is relatively easy to make a browser plugin that overrides the default styles of a site. While working for Canonical, I did one for Launchpad:
https://chrome.google.com/webstore/detail/launchpad-tweaks/p...
I still think GH's insistence on 8-space tabs is part of a secret conspiracy campaign to get people to stop using tabs. It always looks bad when you look at tabbed source code in there, so the easier way to avoid it is to start using spaces instead.
if you use Chrome, try out Octotree
Can anyone explain to me why this is even a feature?
Why did the powers that be decide that web sites should be able to prevent pinch zooming? Why do mobile browsers not provide the option to disable this bug?
In Firefox, you can set browser.ui.zoom.force-user-scalable to true.
Unfortunately, if have JavaScript enabled, some pages are still able to disable the zoom.
Plus decent rendering of README.md at the same base URL.
You get a decent homepage for your project by just pushing your repo.
I wish GitLab just copied the base project page of GitHub.
I love the idea of gitlab but I absolutely cannot enjoy the UI. I have trouble understanding the layout of the project from the base URL. I don't have that problem at all on github.
Edit: I'm a fool. I swapped gitlab and bitbucket. BB interface is absolutely bad to me.
Also, the search documentation is spread out and seems to be missing guidance on features that are crucial. For example, AND works as you would expect (like: hello AND world), but it isn't mentioned anywhere.
Anyway, thanks for posting it!
The link below shows timings for various regex on a 20MiB text file for several different regex softwares. The best code never exceeds half a second for even the worst expressions. Most are much faster.
When you add to this the fact that it's possible to deliberately construct regexes that are much more complicated to evaluate (particularly if you allow extensions beyond a true regular language) - potentially being a DoS target - and many repos won't be cached when the search comes in (or caching them would also be very expensive), the costs just get higher.
In contrast, a simple keyword search can be performed with a predictable, low cost, so it's no wonder that they'd prefer to implement this instead.
Only if you allow extensions, but then they aren't regular expressions.
Re2 excludes them specifically .
They still use Perl-like syntax, and might still be able to parse non-regular languages, but you don't need to worry about users deliberately crafting regexes to eat up CPU time like PCRE.
foo AND bar NOT baz OR fizz
So, it supports AND, NOT, and OR. Nowhere, though, does it say that. I don't know if I can group these to get around precedence either. Parenthesis are ignored. It does mention NOT somewhere. And, there's no navigation to search help by the search button. I had to google to find out any help was available.
Also, it ignores some characters for unknown reasons. Like $, for example. That's a meaningful sigil in Perl, PHP, and so on...it's quite frustrating that it's ignored.
`AND` being implicit in `bar NOT baz`, and in `foo bar`. Also AND/OR is per file, rather than line which I wondered after reading this comment.
There's some information here [0] that's mainly centred on issues/PRs, but some transferable (this might be what you referred to that does mention NOT). There's also a bit more information here [1]; it does at least acknowledge that `$` will be swallowed.
No online service in the world does not index things.
If you need full access to everything, why not just clone the repo and do these things in the comfort of your command line?
(Disclaimer: I'm one of the creators. We currently only support Go officially, but other languages soon on the way via the open-source Language Server Protocol standard. Also, big fans of GitHub and glad to see this move!)
I am guilty of occasionally even viewing my own projects on github to avoid having to put down what I'm doing to check what's in production...
As far as I can tell, Gitlab (still) doesn't have search within repo. It's one of the most useful features on Github for me; often I want to see the definition or uses of some symbol without having to clone the repo. I don't understand why Gitlab doesn't seem to support it.
Damn... I can't even manage to figure out how it works. I consider myself extremely lucky when it returns the expected result, and that seldom happens.
What I like in github .. it's a multiformat http file viewer.