Live data from Hacker News

A Git query language

github.com

61–70 of 72 posts

Re: A Git query language

#61
post #58

But why does it have to look like SQL (and not like xpath or jquery)? Not many people enjoy writing SQL statements on the command line. It's verbose, the order of things is arbitrary...

I would assume that the whole point of the project is to be able to do SQLish queries on a git repo, and that it was written by and for people who are familiar with SQL and have a preference for it over other query languages. And they probably do enjoy writing SQL statements on the command line, however uncommon that may or may not be.

Seems to be very narrow group. How is this relevant to HN? Flagged the story.

Re: A Git query language

#62
post #58

Earlier quoted context omitted.

I would assume that the whole point of the project is to be able to do SQLish queries on a git repo, and that it was written by and for people who are familiar with SQL and have a preference for it over other query languages. And they probably do enjoy writing SQL statements on the command line, however uncommon that may or may not be.

Seems to be very narrow group. How is this relevant to HN? Flagged the story.

You flagged the story because you don't like SQL on the CLI? Come on. Whether or not you enjoy writing SQL on the CLI, SQL is a fine language for querying data, and is probably more common than xpath. JQuery seems like a strange choice too.

Re: A Git query language

#63

Earlier quoted context omitted.

Seems to be very narrow group. How is this relevant to HN? Flagged the story.

You flagged the story because you don't like SQL on the CLI? Come on. Whether or not you enjoy writing SQL on the CLI, SQL is a fine language for querying data, and is probably more common than xpath. JQuery seems like a strange choice too.

I just fail to praise the attitude. "Let's faithfully reproduce the looks of 30 y.o. technology, pseudographic tables included, with make-believe over git".

Re: A Git query language

#64
post #18

Earlier quoted context omitted.

Git map would work for many cases https://github.com/icefox/git-map Git map ql ...

Thank you for suggesting git-map. I tried it and intend to include it into my workflow. I thought your suggestion was a good one so I tested it. It did not work for me due to: "dyld: Library not loaded: libgit2.21.dylib". I assume this is something about my setup (mac, zsh, other stuff) but if you got this working I'd like to know so I can keep trying my with my setup. To clarify: both git-map and gitql work for me,…

git map is just a 8 line bash script so perhaps checking if paths are setup correctly for bash to point to your git binaries if you use zsh most of the time.

Re: A Git query language

#65
post #20
post #18

Earlier quoted context omitted.

Git map would work for many cases https://github.com/icefox/git-map Git map ql ...

Nice. I can see a need for this as a lot of my projects are structured like that (multiple sibling repos). Running 'git map log --grep ...' seems particularly useful. Quick eyeballing of the source, it does not handle whitespace in directory names properly. The for loop would treat them as separate, invalid, entries. Of course I'd also fire someone on the spot that commits a project directory with whitespace in it...

Good point, switched it to a while loop.

Re: A Git query language

#66
post #42
post #40

Oh I love that the example gif includes: select author, message from commits where 'Fuck' in message I'm pretty sure that query's results would fill my screen buffer.

Just for comparison, in Mercurial you would do hg log --template "{author}, {desc}\n" --rev "desc('fuck')"

"Fuck" is right up there with "ch-ch-changes" in my git word cloud.

Re: A Git query language

#68
post #58

Earlier quoted context omitted.

I would assume that the whole point of the project is to be able to do SQLish queries on a git repo, and that it was written by and for people who are familiar with SQL and have a preference for it over other query languages. And they probably do enjoy writing SQL statements on the command line, however uncommon that may or may not be.

Seems to be very narrow group. How is this relevant to HN? Flagged the story.

Well, if you feel so strongly about it, why not build your own tool to support the "preferred" query language?

Re: A Git query language

#69
post #33

Earlier quoted context omitted.

My thoughts went straight to PostgreSQL Foreign Data Wrappers. Something like that would be really helpful!

Wouldn't that require a running Postgres server, though? Seems a bit heavy for ad hoc queries. For something like a GitLab server, though, that would be amazing.

According to the Ubuntu Dependencies[0] it already uses Postgres, it also needs Redis, so with gitlab we are a bit pass the heavy bit.

[0]: http://packages.ubuntu.com/xenial/gitlab

Re: A Git query language

#70
post #26

Earlier quoted context omitted.

Revsets are a wonderful feature, and it's something I wish git had. Just being able to say I want to see what has changed between this branch head and its latest common ancestor with trunk is an incredibly simple and useful thing to be able to do.

Complete guess based on [1], but wouldn't git diff HEAD $(git merge-base HEAD master) work? [1]: https://stackoverflow.com/questions/1549146/find-common-ance...

Beauty of revsets is their ubiquity.

Diff would be `hg diff -r 'ancestor(default, experiment)' -r experiment`

Want to list commits in experiment? Just change diff to log. Generate patch file with all commits? Change it to export.

Post reply on HN