|
|
@ -107,7 +107,7 @@ func cmdCommit(ctx context.Context, cmd *dcmd.Cmd) { |
|
|
|
return nil, fmt.Errorf("error collecting commit message from user: %w", err) |
|
|
|
return nil, fmt.Errorf("error collecting commit message from user: %w", err) |
|
|
|
|
|
|
|
|
|
|
|
} else if *description == "" { |
|
|
|
} else if *description == "" { |
|
|
|
return nil, errors.New("empty commit message, not doing anything") |
|
|
|
return nil, errors.New("empty description, not doing anything") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -129,6 +129,7 @@ func cmdCommit(ctx context.Context, cmd *dcmd.Cmd) { |
|
|
|
startRev := flag.String("start", "", "Revision of the starting commit to accredit (when accrediting a range of changes)") |
|
|
|
startRev := flag.String("start", "", "Revision of the starting commit to accredit (when accrediting a range of changes)") |
|
|
|
endRev := flag.String("end", "HEAD", "Revision of the ending commit to accredit (when accrediting a range of changes)") |
|
|
|
endRev := flag.String("end", "HEAD", "Revision of the ending commit to accredit (when accrediting a range of changes)") |
|
|
|
rev := flag.String("rev", "", "Revision of commit to accredit (when accrediting a single commit)") |
|
|
|
rev := flag.String("rev", "", "Revision of commit to accredit (when accrediting a single commit)") |
|
|
|
|
|
|
|
description := flag.String("descr", "", "Description of changes being accredited") |
|
|
|
cmd.Run(func() (context.Context, error) { |
|
|
|
cmd.Run(func() (context.Context, error) { |
|
|
|
if *rev == "" && *startRev == "" { |
|
|
|
if *rev == "" && *startRev == "" { |
|
|
|
return nil, errors.New("-rev or -start is required") |
|
|
|
return nil, errors.New("-rev or -start is required") |
|
|
@ -161,17 +162,22 @@ func cmdCommit(ctx context.Context, cmd *dcmd.Cmd) { |
|
|
|
} else if len(commits) == 1 && commits[0].Payload.Credential != nil { |
|
|
|
} else if len(commits) == 1 && commits[0].Payload.Credential != nil { |
|
|
|
credPayUn = commits[0].Payload |
|
|
|
credPayUn = commits[0].Payload |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
lastDescr, err := dehub.LastChangeDescription(commits) |
|
|
|
if *description == "" { |
|
|
|
if err != nil { |
|
|
|
lastDescr, err := dehub.LastChangeDescription(commits) |
|
|
|
return nil, fmt.Errorf("determining change description of commit(s): %w", err) |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return nil, fmt.Errorf("determining change description of commit(s): %w", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*description, err = tmpFileMsg(defaultCommitFileMsgTpl, lastDescr) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return nil, fmt.Errorf("collecting credential description from user: %w", err) |
|
|
|
|
|
|
|
} else if *description == "" { |
|
|
|
|
|
|
|
return nil, errors.New("empty description, not doing anything") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
descr, err := tmpFileMsg(defaultCommitFileMsgTpl, lastDescr) |
|
|
|
var err error |
|
|
|
if err != nil { |
|
|
|
credPayUn, err = proj.NewPayloadCredentialFromChanges(*description, commits) |
|
|
|
return nil, fmt.Errorf("collecting credential description from user: %w", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
credPayUn, err = proj.NewPayloadCredentialFromChanges(descr, commits) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, fmt.Errorf("constructing credential commit: %w", err) |
|
|
|
return nil, fmt.Errorf("constructing credential commit: %w", err) |
|
|
|
} |
|
|
|
} |
|
|
|