mirror of
https://github.com/dolthub/dolt.git
synced 2025-12-30 00:40:55 -06:00
log --show-signature and initial test setup
This commit is contained in:
@@ -279,6 +279,7 @@ func CreateLogArgParser(isTableFunction bool) *argparser.ArgParser {
|
||||
ap.SupportsFlag(ParentsFlag, "", "Shows all parents of each commit in the log.")
|
||||
ap.SupportsString(DecorateFlag, "", "decorate_fmt", "Shows refs next to commits. Valid options are short, full, no, and auto")
|
||||
ap.SupportsStringList(NotFlag, "", "revision", "Excludes commits from revision.")
|
||||
ap.SupportsFlag(ShowSignatureFlag, "", "Shows the signature of each commit.")
|
||||
if isTableFunction {
|
||||
ap.SupportsStringList(TablesFlag, "t", "table", "Restricts the log to commits that modified the specified tables.")
|
||||
} else {
|
||||
|
||||
@@ -65,6 +65,7 @@ const (
|
||||
SetUpstreamFlag = "set-upstream"
|
||||
ShallowFlag = "shallow"
|
||||
ShowIgnoredFlag = "ignored"
|
||||
ShowSignatureFlag = "show-signature"
|
||||
SignFlag = "gpg-sign"
|
||||
SilentFlag = "silent"
|
||||
SingleBranchFlag = "single-branch"
|
||||
|
||||
@@ -206,7 +206,7 @@ hint: commit your changes (dolt commit -am \"<message>\") or reset them (dolt re
|
||||
pager := outputpager.Start()
|
||||
defer pager.Stop()
|
||||
|
||||
PrintCommitInfo(pager, 0, false, "auto", commit)
|
||||
PrintCommitInfo(pager, 0, false, false, "auto", commit)
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
@@ -181,7 +181,7 @@ func performCommit(ctx context.Context, commandStr string, args []string, cliCtx
|
||||
pager := outputpager.Start()
|
||||
defer pager.Stop()
|
||||
|
||||
PrintCommitInfo(pager, 0, false, "auto", commit)
|
||||
PrintCommitInfo(pager, 0, false, false, "auto", commit)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -280,10 +280,14 @@ func getExistingTables(revisions []string, queryist cli.Queryist, sqlCtx *sql.Co
|
||||
|
||||
// logCommits takes a list of sql rows that have only 1 column, commit hash, and retrieves the commit info for each hash to be printed to std out
|
||||
func logCommits(apr *argparser.ArgParseResults, commitHashes []sql.Row, queryist cli.Queryist, sqlCtx *sql.Context) error {
|
||||
opts := commitInfoOptions{
|
||||
showSignature: apr.Contains(cli.ShowSignatureFlag),
|
||||
}
|
||||
|
||||
var commitsInfo []CommitInfo
|
||||
for _, hash := range commitHashes {
|
||||
cmHash := hash[0].(string)
|
||||
commit, err := getCommitInfo(queryist, sqlCtx, cmHash)
|
||||
commit, err := getCommitInfoWithOptions(queryist, sqlCtx, cmHash, opts)
|
||||
if commit == nil {
|
||||
return fmt.Errorf("no commits found for ref %s", cmHash)
|
||||
}
|
||||
@@ -338,7 +342,7 @@ func logCompact(pager *outputpager.Pager, apr *argparser.ArgParseResults, commit
|
||||
|
||||
func logDefault(pager *outputpager.Pager, apr *argparser.ArgParseResults, commits []CommitInfo, sqlCtx *sql.Context, queryist cli.Queryist) error {
|
||||
for _, comm := range commits {
|
||||
PrintCommitInfo(pager, apr.GetIntOrDefault(cli.MinParentsFlag, 0), apr.Contains(cli.ParentsFlag), apr.GetValueOrDefault(cli.DecorateFlag, "auto"), &comm)
|
||||
PrintCommitInfo(pager, apr.GetIntOrDefault(cli.MinParentsFlag, 0), apr.Contains(cli.ParentsFlag), apr.Contains(cli.ShowSignatureFlag), apr.GetValueOrDefault(cli.DecorateFlag, "auto"), &comm)
|
||||
if apr.Contains(cli.StatFlag) {
|
||||
if comm.parentHashes != nil && len(comm.parentHashes) == 1 { // don't print stats for merge commits
|
||||
diffStats := make(map[string]*merge.MergeStats)
|
||||
|
||||
@@ -398,7 +398,7 @@ func printMergeStats(fastForward bool,
|
||||
pager := outputpager.Start()
|
||||
defer pager.Stop()
|
||||
|
||||
PrintCommitInfo(pager, 0, false, "auto", commit)
|
||||
PrintCommitInfo(pager, 0, false, false, "auto", commit)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func (cmd PullCmd) Exec(ctx context.Context, commandStr string, args []string, d
|
||||
pager := outputpager.Start()
|
||||
defer pager.Stop()
|
||||
|
||||
PrintCommitInfo(pager, 0, false, "auto", commit)
|
||||
PrintCommitInfo(pager, 0, false, false, "auto", commit)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -144,7 +144,7 @@ func (cmd RevertCmd) Exec(ctx context.Context, commandStr string, args []string,
|
||||
pager := outputpager.Start()
|
||||
defer pager.Stop()
|
||||
|
||||
PrintCommitInfo(pager, 0, false, "auto", commit)
|
||||
PrintCommitInfo(pager, 0, false, false, "auto", commit)
|
||||
})
|
||||
|
||||
return 0
|
||||
|
||||
@@ -326,7 +326,7 @@ func fetchAndPrintCommit(queryist cli.Queryist, sqlCtx *sql.Context, opts *showO
|
||||
pager := outputpager.Start()
|
||||
defer pager.Stop()
|
||||
|
||||
PrintCommitInfo(pager, 0, opts.showParents, opts.decoration, commit)
|
||||
PrintCommitInfo(pager, 0, opts.showParents, false, opts.decoration, commit)
|
||||
})
|
||||
|
||||
if len(parents) == 0 {
|
||||
|
||||
@@ -557,7 +557,7 @@ func GetDoltStatus(queryist cli.Queryist, sqlCtx *sql.Context) (stagedChangedTab
|
||||
}
|
||||
|
||||
// PrintCommitInfo prints the given commit in the format used by log and show.
|
||||
func PrintCommitInfo(pager *outputpager.Pager, minParents int, showParents bool, decoration string, comm *CommitInfo) {
|
||||
func PrintCommitInfo(pager *outputpager.Pager, minParents int, showParents, showSignatures bool, decoration string, comm *CommitInfo) {
|
||||
color.NoColor = false
|
||||
if len(comm.parentHashes) < minParents {
|
||||
return
|
||||
@@ -583,6 +583,14 @@ func PrintCommitInfo(pager *outputpager.Pager, minParents int, showParents bool,
|
||||
}
|
||||
}
|
||||
|
||||
if showSignatures && len(comm.commitMeta.Signature) > 0 {
|
||||
signatureLines := strings.Split(comm.commitMeta.Signature, "\n")
|
||||
for _, line := range signatureLines {
|
||||
pager.Writer.Write([]byte("\n"))
|
||||
pager.Writer.Write([]byte(color.CyanString(line)))
|
||||
}
|
||||
}
|
||||
|
||||
pager.Writer.Write([]byte(fmt.Sprintf("\nAuthor: %s <%s>", comm.commitMeta.Name, comm.commitMeta.Email)))
|
||||
|
||||
timeStr := comm.commitMeta.FormatTS()
|
||||
@@ -641,17 +649,34 @@ func printRefs(pager *outputpager.Pager, comm *CommitInfo, decoration string) {
|
||||
pager.Writer.Write([]byte(yellow.Sprintf("%s) ", joinedReferences)))
|
||||
}
|
||||
|
||||
type commitInfoOptions struct {
|
||||
showSignature bool
|
||||
}
|
||||
|
||||
// getCommitInfo returns the commit info for the given ref.
|
||||
func getCommitInfo(queryist cli.Queryist, sqlCtx *sql.Context, ref string) (*CommitInfo, error) {
|
||||
return getCommitInfoWithOptions(queryist, sqlCtx, ref, commitInfoOptions{})
|
||||
}
|
||||
|
||||
func getCommitInfoWithOptions(queryist cli.Queryist, sqlCtx *sql.Context, ref string, opts commitInfoOptions) (*CommitInfo, error) {
|
||||
hashOfHead, err := getHashOf(queryist, sqlCtx, "HEAD")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting hash of HEAD: %v", err)
|
||||
}
|
||||
|
||||
q, err := dbr.InterpolateForDialect("select * from dolt_log(?, '--parents', '--decorate=full')", []interface{}{ref}, dialect.MySQL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error interpolating query: %v", err)
|
||||
var q string
|
||||
if opts.showSignature {
|
||||
q, err = dbr.InterpolateForDialect("select * from dolt_log(?, '--parents', '--decorate=full', '--show-signature')", []interface{}{ref}, dialect.MySQL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error interpolating query: %v", err)
|
||||
}
|
||||
} else {
|
||||
q, err = dbr.InterpolateForDialect("select * from dolt_log(?, '--parents', '--decorate=full')", []interface{}{ref}, dialect.MySQL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error interpolating query: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
rows, err := GetRowsForSql(queryist, sqlCtx, q)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting logs for ref '%s': %v", ref, err)
|
||||
|
||||
@@ -16,6 +16,7 @@ package sqle
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dolthub/dolt/go/libraries/utils/gpg"
|
||||
"strings"
|
||||
|
||||
"github.com/dolthub/go-mysql-server/sql"
|
||||
@@ -44,9 +45,10 @@ type LogTableFunction struct {
|
||||
notRevisionStrs []string
|
||||
tableNames []string
|
||||
|
||||
minParents int
|
||||
showParents bool
|
||||
decoration string
|
||||
minParents int
|
||||
showParents bool
|
||||
showSignature bool
|
||||
decoration string
|
||||
|
||||
database sql.Database
|
||||
}
|
||||
@@ -57,7 +59,6 @@ var logTableSchema = sql.Schema{
|
||||
&sql.Column{Name: "email", Type: types.Text},
|
||||
&sql.Column{Name: "date", Type: types.Datetime},
|
||||
&sql.Column{Name: "message", Type: types.Text},
|
||||
&sql.Column{Name: "signature", Type: types.Text},
|
||||
}
|
||||
|
||||
// NewInstance creates a new instance of TableFunction interface
|
||||
@@ -141,6 +142,10 @@ func (ltf *LogTableFunction) getOptionsString() string {
|
||||
options = append(options, fmt.Sprintf("--%s", cli.ParentsFlag))
|
||||
}
|
||||
|
||||
if ltf.showSignature {
|
||||
options = append(options, fmt.Sprintf("--%s", cli.ShowSignatureFlag))
|
||||
}
|
||||
|
||||
if len(ltf.decoration) > 0 && ltf.decoration != "auto" {
|
||||
options = append(options, fmt.Sprintf("--%s %s", cli.DecorateFlag, ltf.decoration))
|
||||
}
|
||||
@@ -162,6 +167,9 @@ func (ltf *LogTableFunction) Schema() sql.Schema {
|
||||
if shouldDecorateWithRefs(ltf.decoration) {
|
||||
logSchema = append(logSchema, &sql.Column{Name: "refs", Type: types.Text})
|
||||
}
|
||||
if ltf.showSignature {
|
||||
logSchema = append(logSchema, &sql.Column{Name: "signature", Type: types.Text})
|
||||
}
|
||||
|
||||
return logSchema
|
||||
}
|
||||
@@ -254,6 +262,7 @@ func (ltf *LogTableFunction) addOptions(expression []sql.Expression) error {
|
||||
|
||||
ltf.minParents = minParents
|
||||
ltf.showParents = apr.Contains(cli.ParentsFlag)
|
||||
ltf.showSignature = apr.Contains(cli.ShowSignatureFlag)
|
||||
|
||||
decorateOption := apr.GetValueOrDefault(cli.DecorateFlag, "auto")
|
||||
switch decorateOption {
|
||||
@@ -594,11 +603,12 @@ var _ sql.RowIter = (*logTableFunctionRowIter)(nil)
|
||||
|
||||
// logTableFunctionRowIter is a sql.RowIter implementation which iterates over each commit as if it's a row in the table.
|
||||
type logTableFunctionRowIter struct {
|
||||
child doltdb.CommitItr
|
||||
showParents bool
|
||||
decoration string
|
||||
cHashToRefs map[hash.Hash][]string
|
||||
headHash hash.Hash
|
||||
child doltdb.CommitItr
|
||||
showParents bool
|
||||
showSignature bool
|
||||
decoration string
|
||||
cHashToRefs map[hash.Hash][]string
|
||||
headHash hash.Hash
|
||||
|
||||
tableNames []string
|
||||
}
|
||||
@@ -615,12 +625,13 @@ func (ltf *LogTableFunction) NewLogTableFunctionRowIter(ctx *sql.Context, ddb *d
|
||||
}
|
||||
|
||||
return &logTableFunctionRowIter{
|
||||
child: child,
|
||||
showParents: ltf.showParents,
|
||||
decoration: ltf.decoration,
|
||||
cHashToRefs: cHashToRefs,
|
||||
headHash: h,
|
||||
tableNames: tableNames,
|
||||
child: child,
|
||||
showParents: ltf.showParents,
|
||||
showSignature: ltf.showSignature,
|
||||
decoration: ltf.decoration,
|
||||
cHashToRefs: cHashToRefs,
|
||||
headHash: h,
|
||||
tableNames: tableNames,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -655,12 +666,13 @@ func (ltf *LogTableFunction) NewDotDotLogTableFunctionRowIter(ctx *sql.Context,
|
||||
}
|
||||
|
||||
return &logTableFunctionRowIter{
|
||||
child: child,
|
||||
showParents: ltf.showParents,
|
||||
decoration: ltf.decoration,
|
||||
cHashToRefs: cHashToRefs,
|
||||
headHash: headHash,
|
||||
tableNames: tableNames,
|
||||
child: child,
|
||||
showParents: ltf.showParents,
|
||||
showSignature: ltf.showSignature,
|
||||
decoration: ltf.decoration,
|
||||
cHashToRefs: cHashToRefs,
|
||||
headHash: headHash,
|
||||
tableNames: tableNames,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -765,7 +777,18 @@ func (itr *logTableFunctionRowIter) Next(ctx *sql.Context) (sql.Row, error) {
|
||||
row = row.Append(sql.NewRow(getRefsString(branchNames, isHead)))
|
||||
}
|
||||
|
||||
row = row.Append(sql.NewRow(meta.Signature))
|
||||
if itr.showSignature {
|
||||
if len(meta.Signature) > 0 {
|
||||
out, err := gpg.Verify(ctx, []byte(meta.Signature))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
row = row.Append(sql.NewRow(string(out)))
|
||||
} else {
|
||||
row = row.Append(sql.NewRow(""))
|
||||
}
|
||||
}
|
||||
|
||||
return row, nil
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ func Sign(ctx context.Context, keyId string, message []byte) ([]byte, error) {
|
||||
|
||||
func Verify(ctx context.Context, signature []byte) ([]byte, error) {
|
||||
args := []string{"--verify"}
|
||||
outBuf, _, err := execGpgAndReadOutput(ctx, signature, args)
|
||||
_, errBuf, err := execGpgAndReadOutput(ctx, signature, args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return outBuf.Bytes(), nil
|
||||
return errBuf.Bytes(), nil
|
||||
}
|
||||
|
||||
func listenToOut(ctx context.Context, eg *errgroup.Group, r io.Reader) *bytes.Buffer {
|
||||
@@ -103,7 +103,7 @@ func listenToOut(ctx context.Context, eg *errgroup.Group, r io.Reader) *bytes.Bu
|
||||
return buf
|
||||
}
|
||||
|
||||
// Throws away all intersperesed text and returns all decoded PEM blocks, in the order they are read.
|
||||
// DecodeAllPEMBlocks decodes all PEM blocks from a byte slice.
|
||||
func DecodeAllPEMBlocks(bs []byte) ([]*pem.Block, error) {
|
||||
const beginHeaderPrefix = "BEGIN "
|
||||
const pemSeperator = "-----"
|
||||
|
||||
@@ -42,12 +42,16 @@ YN6Sszg+o8Aw0AT4M6nrLTe3YaIE6sR4YMxOCSOPAT9oSDg1t5s=
|
||||
=fklH
|
||||
-----END PGP SIGNATURE-----`
|
||||
|
||||
pemBlocks, err := decodeAllPEMBlocks([]byte(pemBlock))
|
||||
pemBlocks, err := DecodeAllPEMBlocks([]byte(pemBlock))
|
||||
require.NoError(t, err)
|
||||
fmt.Println(len(pemBlocks))
|
||||
require.Len(t, pemBlocks, 2)
|
||||
require.True(t, containsBlockOfType(pemBlocks, "PGP SIGNED MESSAGE"))
|
||||
require.True(t, containsBlockOfType(pemBlocks, "PGP SIGNATURE"))
|
||||
|
||||
output, err := Verify(context.Background(), []byte(pemBlock))
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, output)
|
||||
}
|
||||
|
||||
func containsBlockOfType(blocks []*pem.Block, blockType string) bool {
|
||||
|
||||
81
integration-tests/bats/private.pgp
Normal file
81
integration-tests/bats/private.pgp
Normal file
@@ -0,0 +1,81 @@
|
||||
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
|
||||
lQVXBGbXZJ8BDAC13zW1ncGNBLNPOUcoSDrs++wqv4nkpxPQSOAkSljDwJlwAGeC
|
||||
UFhKRZdAxh71kw4iEeaOQISynRE6xtRvEZArVZPWBUboFaSp7vu9AYADEutYqU6G
|
||||
/47lFf3PyQNSvRcgNaLYkxKQqg+rpZQYbnUD4b4y3suYSeTvAnAXwp6EAyHc0fuC
|
||||
MmcVzRCVjkqLH0ycqAu+wbXS+5OuoJrPTOpSppX5Q89oZzt4bOBorAY1TeHi9uHZ
|
||||
8aF5LZosKetQU6bonIaMQZ10L0j99dd6+dOWysmzH7//aI3RjLwp2GnX290opP99
|
||||
L2ZrqjTKqViOS8RSfEscToEE4lYefAzoGUeFqF/+fO64tfnOMxeyUP+f2yN+UgYe
|
||||
OuYWtSKqsnVOwijH6MvrmdAP3yk1Bt3878+FRlcYctbFnAj01wu0spFs9n1Uo98x
|
||||
n7OIth+c+jfvHCwXlVq4tSq2RhP2SqN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sgj2Zjc7gUDACg+WvCyA8K
|
||||
1LMgjIxEGySflZTRoJpexcQe8l4eSUJ8M4efxk4QwGjv4O7uVgooXcOxxQKSeLRx
|
||||
3mbVKhZgiUr9RUPozg2h/eyaROnur0Pff3AVtfwtDjaPlv3vPBx4MS5XBMS8q2/h
|
||||
s4J1WAlQcGu0dNKCAuX2IOWa7+HAUfOWi4CTz11GMZQ95aeZoBgIqzHkX7BM0BfN
|
||||
jpKR5IH7gATNjtYAf2ld1DtSO44po/MuaR1FUUYMOkqlHN5fHGD+rYFSB2x7SKjw
|
||||
BNtxQE3boKI+HN8faVuOwXhoiP4aTsrI5NdDhWMvqye17qBqdk8Y0XoZ+q25NQHb
|
||||
cXicy7bhBVJGMATNnf8jbyVO5zbNwUATEYS5frY+9mx0lLYk2yIJQavdemEM4d0q
|
||||
k9h5boXVbAwcsL6MY0jlc8u9BfbA7am1X+Jxxe5scg7v7vsqmtZKzBVBxdRwoN7t
|
||||
tuG+dNCRwXPHbeCxqu4UJyDG9yXULeWi5tKHu/CmoJoom0+M4B7Ln/I=
|
||||
=WzPV
|
||||
-----END PGP PRIVATE KEY BLOCK-----
|
||||
54
integration-tests/bats/signed.bats
Normal file
54
integration-tests/bats/signed.bats
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bats
|
||||
load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
|
||||
setup() {
|
||||
setup_common
|
||||
}
|
||||
|
||||
teardown() {
|
||||
assert_feature_version
|
||||
teardown_common
|
||||
}
|
||||
|
||||
init_gpg() {
|
||||
# check if gpg is installed properly
|
||||
run which gpg
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check for existence of public.gpg and private.gpg
|
||||
run gpg --list-keys
|
||||
if [[ "$output" =~ "573DA8C6366D04E35CDB1A44E09A0B208F666373" ]]; then
|
||||
echo "key exists"
|
||||
else
|
||||
echo "importing $BATS_TEST_DIRNAME/private.pgp"
|
||||
run gpg --import "$BATS_TEST_DIRNAME/private.pgp"
|
||||
[ "$status" -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "signing a dolt commit" {
|
||||
init_gpg
|
||||
run dolt sql -q "CREATE TABLE t (pk INT primary key);"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt add .
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt commit -m "initial commit"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt sql -q "INSERT INTO t VALUES (1);"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt add .
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt commit -S "573DA8C6366D04E35CDB1A44E09A0B208F666373" -m "signed commit"
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt log --show-signature
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ 'gpg: Good signature from "Test User <test@dolthub.com>"' ]] || false
|
||||
}
|
||||
Reference in New Issue
Block a user