Coder Social home page Coder Social logo

gitql's Introduction

Gitql Go Report Card Open Source Helpers License MIT

Gitql is a Git query language.

In a repository path...

how to use

See more here

Reading the code

โš ๏ธ Gitql is my first golang project. If you are a beginner looking for using the project as a guideline (how to organise or make an idiomatic go code), I recommend you polyglot instead.

Requirements

  • Go 1.16+

How to install

You can access the releases page and just grab the binary. If you want to compile itself just run go build ..

Examples

gitql "your query"
or
git ql "your query"

As an example, this is the commits table:

commits
author
author_email
committer
committer_email
hash
date
message
full_message

(see more tables here)

Example Commands

  • select hash, author, message from commits limit 3
  • select hash, message from commits where 'hell' in full_message or 'Fuck' in full_message
  • select hash, message, author_email from commits where author = 'cloudson'
  • select date, message from commits where date < '2014-04-10'
  • select message from commits where 'hell' in message order by date asc
  • select distinct author from commits where date < '2020-01-01'

Questions?

gitql or open an issue

Notes:

  • Gitql doesn't want to kill git log - it was created just for science! ๐Ÿ˜…
  • It's read-only - no deleting, inserting, or updating tables or commits. ๐Ÿ˜
  • The default limit is 10 rows.
  • It's inspired by textql.
  • Gitql is a compiler/interpreter instead of just read a sqlite database with all commits, tags, etc. because we would need to sync the tables every time before run sql and we would have sqlite bases for each repository. ๐Ÿ˜

gitql's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gitql's Issues

Make fail on 1.1.1, "Inconsistency detected"

Having run

go get -u -d github.com/cloudson/gitql
cd $GOPATH/src/github.com/cloudson/gitql
sudo apt-get install -y cmake
git checkout 1.1.1
make

I get the following output from compiling:

Preparing...

+ git clone --depth 1 --single-branch git://github.com/cloudson/libgit2 libgit2
Cloning into 'libgit2'...
remote: Counting objects: 3497, done.
remote: Compressing objects: 100% (2722/2722), done.
remote: Total 3497 (delta 104), reused 3495 (delta 104), pack-reused 0
Receiving objects: 100% (3497/3497), 3.27 MiB | 1.73 MiB/s, done.
Resolving deltas: 100% (104/104), done.
Checking connectivity... done.
+ cd libgit2
+ cmake -DTHREADSAFE=ON -DBUILD_CLAR=OFF -DCMAKE_INSTALL_PREFIX=/home/m1ke/.go/src/github.com/cloudson/gitql/libgit2/install .
Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed!
make: *** [prepare] Error 127

Roadmap for release 1.0.0

  • Management with alias
select * from commits c where c.hash = 'e69de2'
  • Create functions
    • NOW(), COUNT(), DATE_FORMAT()...
  • IS NULL as possible right value

Features about "databases"

Some notes to the future

  1. Show Databases
show databases; 

is similar to

git branch -a 

or something like that.

  1. Change to another database
use develop 

is similar to

git checkout develop  

Parse error don't include newline at the end

If you make error in sql you get error and there are no new line at the end so it mess up command line in bash, you need to press enter and then up arrow to edit the command.

building from src on OS/X (and/or installing)

After makeing on Mac, fails with *.dyld thus:

$ ./gitql 'select author, message, hash from commits where "travis" in message'
dyld: Library not loaded: libgit2.21.dylib
  Referenced from: ${GOPATH}/src/github.com/cloudson/gitql/./gitql
  Reason: image not found
Abort trap: 6

According to apple developer docs,
you should be able to set any of
LD_LIBRARY_PATH,
DYLD_LIBRARY_PATH, or
DYLD_FALLBACK_LIBRARY_PATH.

but for me (on Sierra 10.12.1), only the last two work.

An alternative not requiring an environment variable is to install the libraries (link them)
in /usr/local/lib.

Running this post-installation script from the same directory as make, on Mac works for me. I'll leave it to you to edit the echo out.

for i in  $(PWD)/libgit2/install/lib/lib*
do
    targ="$(basename $i)"
    bn=$targ
    dn="$(dirname $i)"
    [ -L "$i" ] && targ="$(readlink $i)"
    echo "ln -s $dn/$targ /usr/local/lib/$bn"
done

Note: If you ever run make clean from the build directory, your installed commands will stop working, so it may be wiser to copy the two main *.dyld files into /usr/local/bin, and link everything else back to them. Doing that could look something like this:

for i in  $(PWD)/libgit2/install/lib/lib*
do
    [ -L "$i" ] && echo "ln -s /usr/local/lib/$(readlink $i) /usr/local/lib/${sr}" \
                    || echo "cp $i /usr/local/lib"
done

Error: git-ql died of signal 9

Environment Details -

  • Operating System - MAC OS Sierra (10.12.4)
  • Go version - go1.8
  • cmake version - 3.8.0
  • make version - GNU Make 3.81

I have installed gitql as mentioned in the README file.

Whenever I run gitql, I get the following error -

paritoshwalvekar in ~/go/src/github.com/cloudson/gitql on develop ฮป gitql
[1]    10778 killed     gitql
paritoshwalvekar in ~/go/src/github.com/cloudson/gitql on develop ฮป git ql
error: git-ql died of signal 9

If I have missed something obvious, I would be glad to fix that.

Installation on mac os x

Great idea!

I have a problem with installation, after I've done everything by instruction, and then tried

gitql

I've got the next one:

dyld: Library not loaded: libgit2.0.dylib
Referenced from: /usr/local/bin/gitql
Reason: image not found
Trace/BPT trap: 5

Any idea how to fix that quickly?

pkg-config: exec: "pkg-config": executable file not found in $PATH

Following install steps.

1) go get -u -d github.com/cloudson/gitql
2) cd $GOPATH/src/github.com/cloudson/gitql
3) make
4) sudo make install
5) export LD_LIBRARY_PATH=$PWD/libgit2/install/lib on linux or export DYLD_LIBRARY_PATH=$PWD/libgit2/install/libon Mac OS.

on the the 3rd step it goes

Building...
# pkg-config --cflags libgit2 libgit2
pkg-config: exec: "pkg-config": executable file not found in $PATH
make: *** [build] Error 2

Error while make tasks

Hi @cloudson

I was trying to install this on my system but it throws the following error

make[1]: Leaving directory '/home/eklavya/go/src/github.com/cloudson/gitql/libgit2'
Building...
# github.com/cloudson/git2go
../git2go/blob.go:4:18: fatal error: git2.h: No such file or directory
compilation terminated.
Makefile:20: recipe for target 'build' failed
make: *** [build] Error 2

Could you help me out here ?

Library not loaded: libgit2.21.dylib

I'm on OSX 10.11.6 and I followed the instructions, but it fails when I'm trying to use it:

> gitql 'select author from commits'
dyld: Library not loaded: libgit2.21.dylib
  Referenced from: /usr/local/bin/gitql
  Reason: image not found
Trace/BPT trap: 5

Make failed for git2go

When trying to build, I'm getting this error:

Building...
# github.com/cloudson/git2go
../git2go/clone.go:37: copts.remote_name undefined (type C.struct_git_clone_options has no field or method remote_name)
../git2go/clone.go:38: copts.remote_name undefined (type C.struct_git_clone_options has no field or method remote_name)
../git2go/clone.go:71: ptr.ignore_cert_errors undefined (type *C.struct_git_clone_options has no field or method ignore_cert_errors)
../git2go/clone.go:73: ptr.ignore_cert_errors undefined (type *C.struct_git_clone_options has no field or method ignore_cert_errors)
Makefile:20: recipe for target 'build' failed
make: *** [build] Error 2

Error when searching for something that isn't in a message

When doing a command like

gitql "select hash, message from commits where 'hasdfjk' in message order by date asc"

I get

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x5a5d20, 0xc820010170)
        /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
github.com/cloudson/gitql/runtime.walkCommits(0xc82000a560, 0xc820053e50)
        /home/joel/Go/src/github.com/cloudson/gitql/runtime/commits.go:58 +0x42e
github.com/cloudson/gitql/runtime.Run(0xc82000a560)
        /home/joel/Go/src/github.com/cloudson/gitql/runtime/runtime.go:79 +0x15f
main.main()
        /home/joel/Go/src/github.com/cloudson/gitql/gitql.go:29 +0x372

This should fail more gracefully

Error when I use the plugin

dyld: Library not loaded: libgit2.21.dylib
Referenced from: /usr/local/bin/gitql
Reason: image not found
[1] 56160 abort gitql "select message from commits"

I'm on Mac OSX

Publish in software repos

Is it possible to publish this as a software package in open source software repos like Debian / centos repos. People can discover and install this by using

sudo apt install gitql

or

sudo yum install gitql

like or regex search

It would be nice to have like or regex keywords to search commits by part of the message like this:

select message from commits where message like "%console.log%"

to have all commits that have console.log in it or when count(*) is added

select count(*) from commits where message like "%console.log%"

Distinct

One more feature request.

SELECT DISTINCT commiter FROM commits

to show all contributors

Message wrong when using proxy tables

The tables "tags" and "branches" are something like views from "refs", so

  1. Problem 1

select message from tags

throws an error: table 'refs' has not field 'message'.

  1. Problem 2
    select * from tags where type = 'blah'

returns null instead of error, because table refs has the field type ๐Ÿ˜•

Add a field in branches table with the remote(s)

So we can filter branches i.e. WHERE remote="origin".

An additional column to know if they are locale or just remote branches, plus another column for those which are currently merged would be awesome too.

Error on parsing

Query
"select message from commits where name > 2"

Expected error
Table 'commits' has not field 'name'

Error found
Expected and found T_NUMERIC

Display of multiline commit messages

When a commit message is spread over multiple lines E.g.:

This is first line of message:
* Second
* Third

Then only the first line This is first line of message: gets output in the table.

Wrong "Order by"

Order by is wrong :
The "operator" just sorts a page, the result itself.

Eg:.
select author, message from commits

author message
cloudson 1
hgfischer 2
jeanpimentel 3

select author message from commits order by message desc limit 2

author message
hgfischer 2
cloudson 1

It happens because :

  1. gitql executes select author from commits limit 2
  2. it sorts the result page by message field

Why the obvious solution is a bad idea?
Because we would need:

  1. gitql executes select author from commits
  2. it sorts all commits (god, could be a lot of memory)
  3. choose just the two first lines

Tokens, reserved words and possible limitations

Let's go!
Gitql will never insert data, just read them from a git repository.
At first, many reserved words (e.g. "in" , "group by", "join" ...) will not be supported.
Below, the list of reserved words and their tokens for the first release.

Reserved word (lexeme) Token
select T_SELECT
from T_FROM
where T_WHERE
order T_ORDER
by T_BY
limit T_LIMIT
desc T_DESC
asc T_ASC
* T_WILD_CARD
, T_COMMA
; T_SEMICOLON
> T_GREATER
< T_SMALLER
>= T_GREATER_OR_EQUAL
<= T_SMALLER_OR_EQUAL
= T_EQUAL

links:
http://en.wikipedia.org/wiki/Lexical_analysis
http://us3.php.net/manual/pt_BR/tokens.php

benchmarks

Do you have any benchmarks for this tool? it seems very cool, but would like to know how performant it is in big projects (linux kernel for instance) ? Maybe others have the same question, it could make sense to add them to the README. (I understand that performance may not be your first goal for this project)

Adding the package to awesome-go.

Hi guys, I think this a a wonderful piece of work and I wanted to add it to the awesome-go list, but it's running into trouble with the CI.

Could you help me out?

JSON output?

That'd make it useful for integrating with other tools.

question: date query

First of all, I really liked this tool. Thanks for it... Can you please give some more date query examples ? between dates for instance? I cross checked via git's:

git log --online --since='4 months ago' --date=relative

and compared to git sql... It's like maximum 10 results for each query ?

Better videos showing the tool

As gitql has changed, we need to improve the documentation with new videos showing the features.
I love the asciinema tool and I've tried to create a new one there.
I thought to create specific short videos about

  • How to work with range dates
  • How to use the different output types
  • How to use the in word or sorting lines
  • How to search for other tables different than commits

Make failed

I get this error when running make:

make[1]: Leaving directory `$HOME/go/src/github.com/cloudson/gitql/libgit2'
Building...
# github.com/cloudson/git2go
37: error: 'GIT_FILEMODE_NEW' undeclared (first use in this function)
make: *** [build] Error 2

cmake and libgit2 are installed.

Make failed on version 1.0.1

I am using Mac OS X 10.9.2 and here is the error report:

Preparing...

+ git clone --depth 1 --single-branch git://github.com/libgit2/libgit2 libgit2
Cloning into 'libgit2'...
remote: Counting objects: 3471, done.
remote: Compressing objects: 100% (2694/2694), done.
remote: Total 3471 (delta 118), reused 2820 (delta 102)
Receiving objects: 100% (3471/3471), 2.33 MiB | 407.00 KiB/s, done.
Resolving deltas: 100% (118/118), done.
Checking connectivity... done.
+ cd libgit2
+ cmake -DTHREADSAFE=ON -DBUILD_CLAR=OFF -DCMAKE_INSTALL_PREFIX=/Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install .
-- The C compiler identification is Clang 5.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found OpenSSL: /usr/lib/libssl.dylib;/usr/lib/libcrypto.dylib (found version "0.9.8y")
-- Could NOT find HTTP_Parser (missing:  HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)
-- http-parser was not found or is too old; using bundled 3rd-party sources.
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Found Iconv: -L/usr/lib -liconv
-- Performing Test IS_FVISIBILITY=HIDDEN_SUPPORTED
-- Performing Test IS_FVISIBILITY=HIDDEN_SUPPORTED - Success
-- Performing Test IS_WNO-MISSING-FIELD-INITIALIZERS_SUPPORTED
-- Performing Test IS_WNO-MISSING-FIELD-INITIALIZERS_SUPPORTED - Success
-- Performing Test IS_WSTRICT-ALIASING=2_SUPPORTED
-- Performing Test IS_WSTRICT-ALIASING=2_SUPPORTED - Success
-- Performing Test IS_WSTRICT-PROTOTYPES_SUPPORTED
-- Performing Test IS_WSTRICT-PROTOTYPES_SUPPORTED - Success
-- Performing Test IS_WDECLARATION-AFTER-STATEMENT_SUPPORTED
-- Performing Test IS_WDECLARATION-AFTER-STATEMENT_SUPPORTED - Success
-- Performing Test IS_WNO-UNUSED-CONST-VARIABLE_SUPPORTED
-- Performing Test IS_WNO-UNUSED-CONST-VARIABLE_SUPPORTED - Success
-- Performing Test IS_WNO-UNUSED-FUNCTION_SUPPORTED
-- Performing Test IS_WNO-UNUSED-FUNCTION_SUPPORTED - Success
-- Performing Test IS_WNO-DEPRECATED-DECLARATIONS_SUPPORTED
-- Performing Test IS_WNO-DEPRECATED-DECLARATIONS_SUPPORTED - Success
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2
+ make install
Scanning dependencies of target git2
[  0%] Building C object CMakeFiles/git2.dir/src/attr.c.o
[  1%] Building C object CMakeFiles/git2.dir/src/attr_file.c.o
[  2%] Building C object CMakeFiles/git2.dir/src/attrcache.c.o
[  3%] Building C object CMakeFiles/git2.dir/src/blame.c.o
[  4%] Building C object CMakeFiles/git2.dir/src/blame_git.c.o
[  5%] Building C object CMakeFiles/git2.dir/src/blob.c.o
[  5%] Building C object CMakeFiles/git2.dir/src/branch.c.o
[  6%] Building C object CMakeFiles/git2.dir/src/buf_text.c.o
[  7%] Building C object CMakeFiles/git2.dir/src/buffer.c.o
[  8%] Building C object CMakeFiles/git2.dir/src/cache.c.o
[  9%] Building C object CMakeFiles/git2.dir/src/checkout.c.o
[ 10%] Building C object CMakeFiles/git2.dir/src/cherrypick.c.o
[ 11%] Building C object CMakeFiles/git2.dir/src/clone.c.o
[ 11%] Building C object CMakeFiles/git2.dir/src/commit.c.o
[ 12%] Building C object CMakeFiles/git2.dir/src/commit_list.c.o
[ 13%] Building C object CMakeFiles/git2.dir/src/config.c.o
[ 14%] Building C object CMakeFiles/git2.dir/src/config_cache.c.o
[ 15%] Building C object CMakeFiles/git2.dir/src/config_file.c.o
[ 16%] Building C object CMakeFiles/git2.dir/src/crlf.c.o
[ 17%] Building C object CMakeFiles/git2.dir/src/date.c.o
[ 17%] Building C object CMakeFiles/git2.dir/src/delta-apply.c.o
[ 18%] Building C object CMakeFiles/git2.dir/src/delta.c.o
[ 19%] Building C object CMakeFiles/git2.dir/src/diff.c.o
[ 20%] Building C object CMakeFiles/git2.dir/src/diff_driver.c.o
[ 21%] Building C object CMakeFiles/git2.dir/src/diff_file.c.o
[ 22%] Building C object CMakeFiles/git2.dir/src/diff_patch.c.o
[ 23%] Building C object CMakeFiles/git2.dir/src/diff_print.c.o
[ 23%] Building C object CMakeFiles/git2.dir/src/diff_stats.c.o
[ 24%] Building C object CMakeFiles/git2.dir/src/diff_tform.c.o
[ 25%] Building C object CMakeFiles/git2.dir/src/diff_xdiff.c.o
[ 26%] Building C object CMakeFiles/git2.dir/src/errors.c.o
[ 27%] Building C object CMakeFiles/git2.dir/src/fetch.c.o
[ 28%] Building C object CMakeFiles/git2.dir/src/fetchhead.c.o
[ 29%] Building C object CMakeFiles/git2.dir/src/filebuf.c.o
[ 29%] Building C object CMakeFiles/git2.dir/src/fileops.c.o
[ 30%] Building C object CMakeFiles/git2.dir/src/filter.c.o
[ 31%] Building C object CMakeFiles/git2.dir/src/fnmatch.c.o
[ 32%] Building C object CMakeFiles/git2.dir/src/global.c.o
[ 33%] Building C object CMakeFiles/git2.dir/src/graph.c.o
[ 34%] Building C object CMakeFiles/git2.dir/src/hash.c.o
[ 35%] Building C object CMakeFiles/git2.dir/src/hashsig.c.o
[ 35%] Building C object CMakeFiles/git2.dir/src/ident.c.o
[ 36%] Building C object CMakeFiles/git2.dir/src/ignore.c.o
[ 37%] Building C object CMakeFiles/git2.dir/src/index.c.o
[ 38%] Building C object CMakeFiles/git2.dir/src/indexer.c.o
[ 39%] Building C object CMakeFiles/git2.dir/src/iterator.c.o
[ 40%] Building C object CMakeFiles/git2.dir/src/merge.c.o
[ 41%] Building C object CMakeFiles/git2.dir/src/merge_file.c.o
[ 41%] Building C object CMakeFiles/git2.dir/src/message.c.o
[ 42%] Building C object CMakeFiles/git2.dir/src/mwindow.c.o
[ 43%] Building C object CMakeFiles/git2.dir/src/netops.c.o
[ 44%] Building C object CMakeFiles/git2.dir/src/notes.c.o
[ 45%] Building C object CMakeFiles/git2.dir/src/object.c.o
[ 46%] Building C object CMakeFiles/git2.dir/src/object_api.c.o
[ 47%] Building C object CMakeFiles/git2.dir/src/odb.c.o
[ 47%] Building C object CMakeFiles/git2.dir/src/odb_loose.c.o
[ 48%] Building C object CMakeFiles/git2.dir/src/odb_mempack.c.o
[ 49%] Building C object CMakeFiles/git2.dir/src/odb_pack.c.o
[ 50%] Building C object CMakeFiles/git2.dir/src/oid.c.o
[ 51%] Building C object CMakeFiles/git2.dir/src/pack-objects.c.o
[ 52%] Building C object CMakeFiles/git2.dir/src/pack.c.o
[ 52%] Building C object CMakeFiles/git2.dir/src/path.c.o
[ 53%] Building C object CMakeFiles/git2.dir/src/pathspec.c.o
[ 54%] Building C object CMakeFiles/git2.dir/src/pool.c.o
[ 55%] Building C object CMakeFiles/git2.dir/src/posix.c.o
[ 56%] Building C object CMakeFiles/git2.dir/src/pqueue.c.o
[ 57%] Building C object CMakeFiles/git2.dir/src/push.c.o
[ 58%] Building C object CMakeFiles/git2.dir/src/refdb.c.o
[ 58%] Building C object CMakeFiles/git2.dir/src/refdb_fs.c.o
[ 59%] Building C object CMakeFiles/git2.dir/src/reflog.c.o
[ 60%] Building C object CMakeFiles/git2.dir/src/refs.c.o
[ 61%] Building C object CMakeFiles/git2.dir/src/refspec.c.o
[ 62%] Building C object CMakeFiles/git2.dir/src/remote.c.o
[ 63%] Building C object CMakeFiles/git2.dir/src/repository.c.o
[ 64%] Building C object CMakeFiles/git2.dir/src/reset.c.o
[ 64%] Building C object CMakeFiles/git2.dir/src/revert.c.o
[ 65%] Building C object CMakeFiles/git2.dir/src/revparse.c.o
[ 66%] Building C object CMakeFiles/git2.dir/src/revwalk.c.o
[ 67%] Building C object CMakeFiles/git2.dir/src/settings.c.o
[ 68%] Building C object CMakeFiles/git2.dir/src/sha1_lookup.c.o
[ 69%] Building C object CMakeFiles/git2.dir/src/signature.c.o
[ 70%] Building C object CMakeFiles/git2.dir/src/sortedcache.c.o
[ 70%] Building C object CMakeFiles/git2.dir/src/stash.c.o
[ 71%] Building C object CMakeFiles/git2.dir/src/status.c.o
[ 72%] Building C object CMakeFiles/git2.dir/src/strmap.c.o
[ 73%] Building C object CMakeFiles/git2.dir/src/submodule.c.o
[ 74%] Building C object CMakeFiles/git2.dir/src/sysdir.c.o
[ 75%] Building C object CMakeFiles/git2.dir/src/tag.c.o
[ 76%] Building C object CMakeFiles/git2.dir/src/thread-utils.c.o
[ 76%] Building C object CMakeFiles/git2.dir/src/trace.c.o
[ 77%] Building C object CMakeFiles/git2.dir/src/transport.c.o
[ 78%] Building C object CMakeFiles/git2.dir/src/tree-cache.c.o
[ 79%] Building C object CMakeFiles/git2.dir/src/tree.c.o
[ 80%] Building C object CMakeFiles/git2.dir/src/tsort.c.o
[ 81%] Building C object CMakeFiles/git2.dir/src/util.c.o
[ 82%] Building C object CMakeFiles/git2.dir/src/vector.c.o
[ 82%] Building C object CMakeFiles/git2.dir/src/zstream.c.o
[ 83%] Building C object CMakeFiles/git2.dir/src/transports/cred.c.o
[ 84%] Building C object CMakeFiles/git2.dir/src/transports/cred_helpers.c.o
[ 85%] Building C object CMakeFiles/git2.dir/src/transports/git.c.o
[ 86%] Building C object CMakeFiles/git2.dir/src/transports/http.c.o
[ 87%] Building C object CMakeFiles/git2.dir/src/transports/local.c.o
[ 88%] Building C object CMakeFiles/git2.dir/src/transports/smart.c.o
[ 88%] Building C object CMakeFiles/git2.dir/src/transports/smart_pkt.c.o
[ 89%] Building C object CMakeFiles/git2.dir/src/transports/smart_protocol.c.o
[ 90%] Building C object CMakeFiles/git2.dir/src/transports/ssh.c.o
[ 91%] Building C object CMakeFiles/git2.dir/src/transports/winhttp.c.o
[ 92%] Building C object CMakeFiles/git2.dir/src/xdiff/xdiffi.c.o
[ 93%] Building C object CMakeFiles/git2.dir/src/xdiff/xemit.c.o
[ 94%] Building C object CMakeFiles/git2.dir/src/xdiff/xhistogram.c.o
[ 94%] Building C object CMakeFiles/git2.dir/src/xdiff/xmerge.c.o
[ 95%] Building C object CMakeFiles/git2.dir/src/xdiff/xpatience.c.o
[ 96%] Building C object CMakeFiles/git2.dir/src/xdiff/xprepare.c.o
[ 97%] Building C object CMakeFiles/git2.dir/src/xdiff/xutils.c.o
[ 98%] Building C object CMakeFiles/git2.dir/src/unix/map.c.o
[ 99%] Building C object CMakeFiles/git2.dir/src/unix/realpath.c.o
[100%] Building C object CMakeFiles/git2.dir/deps/http-parser/http_parser.c.o
Linking C shared library libgit2.dylib
[100%] Built target git2
Install the project...
-- Install configuration: "Debug"
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/lib/libgit2.0.20.0.dylib
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/lib/libgit2.0.dylib
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/lib/libgit2.dylib
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/lib/pkgconfig/libgit2.pc
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/attr.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/blame.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/blob.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/branch.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/buffer.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/checkout.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/cherrypick.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/clone.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/commit.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/common.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/config.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/cred_helpers.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/diff.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/errors.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/filter.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/graph.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/ignore.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/index.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/indexer.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/inttypes.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/merge.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/message.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/net.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/notes.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/object.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/odb.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/odb_backend.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/oid.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/pack.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/patch.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/pathspec.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/push.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/refdb.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/reflog.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/refs.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/refspec.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/remote.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/repository.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/reset.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/revert.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/revparse.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/revwalk.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/signature.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/stash.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/status.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/stdint.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/strarray.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/submodule.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/commit.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/config.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/diff.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/filter.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/index.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/mempack.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/odb_backend.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/refdb_backend.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/reflog.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/refs.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/sys/repository.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/tag.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/threads.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/trace.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/transport.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/tree.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/types.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2/version.h
-- Installing: /Users/bom_d_van/Code/go/workspace/src/github.com/cloudson/gitql/libgit2/install/include/git2.h
Building...
# github.com/libgit2/git2go
37: error: use of undeclared identifier 'git_checkout_init_opts'; did you mean 'git_checkout_init_options'?
make: *** [build] Error 2

Thanks in advance.

select * from commits

This don't work:

git ql 'select * from commits order by date desc limit 2'

it return:

+-------+
|   *   |
+-------+
| <nil> |
+-------+
| <nil> |
+-------+

field not equal string

How to select first committer that is not me?

I've try this:

select committer from commits where committer <> 'Jakub Jankiewicz' order by date desc limit 1'

but got error:

Expected T_LITERAL and found T_GREATER

and this:

select committer from commits where committer != 'Jakub Jankiewicz' order by date desc limit 1

return:

+------------------+
|    committer     |
+------------------+
| Jakub Jankiewicz |
+------------------+

Add COUNT(*)

For instance for counting the number of commits of an Author ?

interactive mode

An interactive mode similar to mysql could be cool ...

gitql -i
> select author from commits 
...
> select * from tags limit 3 
...

For this, we need something like goline

Keep the usage of error simpler

Currently we are using a lot of different variables to use errors (err, err2, err3). Well, how can I say it... it's not necessary ๐Ÿ˜… .

Order by desc/asc

It seems that the two queries return the same results:

git ql "select message from commits order by date asc limit 10"
git ql "select message from commits order by date desc limit 10"

sudo make install cp: ./gitql: No such file or directory

Hello, when I try install sudo make install the terminal returns the message cp: ./gitql: No such file or directory make: *** [install] Error 1. Example install:

โžœ  gitql git:(develop) go get -u -d github.com/cloudson/gitql                   
โžœ  gitql git:(develop) cd $GOPATH/src/github.com/cloudson/gitql
โžœ  gitql git:(develop) make
Preparing...

+ git clone --depth 1 --single-branch git://github.com/cloudson/libgit2 libgit2
Cloning into 'libgit2'...
remote: Counting objects: 3497, done.
remote: Compressing objects: 100% (2722/2722), done.
remote: Total 3497 (delta 104), reused 3495 (delta 104), pack-reused 0
Receiving objects: 100% (3497/3497), 3.27 MiB | 755.00 KiB/s, done.
Resolving deltas: 100% (104/104), done.
Checking connectivity... done.
Checking out files: 100% (2901/2901), done.
+ cd libgit2
+ cmake -DTHREADSAFE=ON -DBUILD_CLAR=OFF -DCMAKE_INSTALL_PREFIX=/Users/andres/workspace/golang/src/github.com/cloudson/gitql/libgit2/install .
/Users/andres/workspace/golang/src/github.com/cloudson/git2go/script/build-libgit2.sh: line 8: cmake: command not found
make: *** [prepare] Error 127
โžœ  gitql git:(develop) sudo make install
cp: ./gitql: No such file or directory
make: *** [install] Error 1
โžœ  gitql git:(develop) 

Thanks!!

Add 'not' reserved word

I see I can run something like

select message from commits where 'hell' in message order by date asc

but is it possible to run something like

select message from commits where 'hell' NOT in message order by date asc

git2.h: No such file or directory when building

Currently trying to install as per the steps in the readme and this error occurs on make

-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/branch.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/revwalk.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/blame.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/attr.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/transport.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/ignore.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/stdint.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2/submodule.h
-- Up-to-date: /home/landry/prog/go/src/github.com/cloudson/gitql/libgit2/install/include/git2.h
make[1]: Leaving directory '/home/landry/prog/go/src/github.com/cloudson/gitql/libgit2'
Building...
# github.com/cloudson/git2go
../git2go/blob.go:4:18: fatal error: git2.h: No such file or directory
compilation terminated.
Makefile:20: recipe for target 'build' failed
make: *** [build] Error 2

System

  • Ubuntu 16.04
  • Go 1.7.4

Option to export git log to sqlite

When this command runs it creates an in memory sqlite database with all tables and throws us in the sqlite3 shell (possibly with --dump, which simply stores the tables in a sqlite db disc based file). This will allow much richer query.

Recursive open repository

Cited on issue #10 , could be better open repositories in any subpath.

I sent a PR about it. In bad case, gitql will use cloudson/git2go or will call C library manually

Publish in Homebrew

Make gitql available through homebrew to be installed via command brew install gitql
A sub-task of #63

I'll start working on this first

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.