-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some restructuring to move the
libgit2
modules into their own packa…
…ge `native`
- Loading branch information
1 parent
89b40e0
commit d7eeeb8
Showing
15 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tables/internal/git/blame_test.go → tables/internal/git/native/blame_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package git_test | ||
package native_test | ||
|
||
import ( | ||
"encoding/csv" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Package native provides virtual table implementations for git tables using libgit2 | ||
// via the git2go bindings (https://github.com/libgit2/git2go). | ||
// Some operations are more performant using libgit2 vs go-git, namely, what's involved in | ||
// the `stats`, `files` and `blame` tables, which are implemented in this package. | ||
package native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tables/internal/git/files_test.go → tables/internal/git/native/files_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package git_test | ||
package native_test | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package native_test | ||
|
||
import ( | ||
"database/sql" | ||
"os" | ||
"testing" | ||
|
||
"github.com/askgitdev/askgit/pkg/locator" | ||
_ "github.com/askgitdev/askgit/pkg/sqlite" | ||
"github.com/askgitdev/askgit/tables" | ||
_ "github.com/mattn/go-sqlite3" | ||
"go.riyazali.net/sqlite" | ||
) | ||
|
||
func init() { | ||
// register sqlite extension when this package is loaded | ||
sqlite.Register(tables.RegisterFn( | ||
tables.WithExtraFunctions(), tables.WithRepoLocator(locator.CachedLocator(locator.MultiLocator())), | ||
)) | ||
} | ||
|
||
// tests' entrypoint that registers the extension | ||
// automatically with all loaded database connections | ||
func TestMain(m *testing.M) { os.Exit(m.Run()) } | ||
|
||
// Memory represents a uri to an in-memory database | ||
const Memory = "file:testing.db?mode=memory" | ||
|
||
// Connect opens a connection with the sqlite3 database using | ||
// the given data source address and pings it to check liveliness. | ||
func Connect(t *testing.T, dataSourceName string) *sql.DB { | ||
t.Helper() | ||
db, err := sql.Open("sqlite3", dataSourceName) | ||
if err != nil { | ||
t.Fatalf("failed to open connection: %v", err.Error()) | ||
} | ||
|
||
if err = db.Ping(); err != nil { | ||
t.Fatalf("failed to open connection: %v", err.Error()) | ||
} | ||
|
||
return db | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tables/internal/git/stats_test.go → tables/internal/git/native/stats_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package git_test | ||
package native_test | ||
|
||
import ( | ||
"testing" | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters