Skip to content

Commit

Permalink
Merge pull request #24 from apiiro/talfin/fix-errorWithCode-reference
Browse files Browse the repository at this point in the history
Fix ErrorWithCode (de)reference
  • Loading branch information
TalfinApiiro authored Feb 5, 2024
2 parents e15eac9 + 5318324 commit 7ca6906
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tool to create a git revision snapshot for an existing repository clone.

```
NAME:
git-snap - 1.19 - Create a git revision snapshot for an existing repository clone. Symbolic link files will be omitted.
git-snap - 1.20 - Create a git revision snapshot for an existing repository clone. Symbolic link files will be omitted.
USAGE:
git-snap --src value --rev value --out value [optional flags]
Expand Down
14 changes: 7 additions & 7 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (provider *repositoryProvider) dumpFile(repository *git.Repository, name st
err = ioutil.WriteFile(targetFilePath, contentsBytes, TARGET_PERMISSIONS)
if err != nil {
if strings.Contains(err.Error(), "file name too long") {
return util.ErrorWithCode{
return &util.ErrorWithCode{
StatusCode: util.ERROR_PATH_TOO_LONG,
InternalError: err,
}, false
Expand Down Expand Up @@ -311,10 +311,10 @@ func (provider *repositoryProvider) snapshot(repository *git.Repository, commit

tree, err := commit.Tree()
if err != nil {
return 0, util.ErrorWithCode{
StatusCode: util.ERROR_TREE_NOT_FOUND,
InternalError: fmt.Errorf("failed to get tree of commit '%v': %v", commit.Hash, err),
}
return 0, &util.ErrorWithCode{
StatusCode: util.ERROR_TREE_NOT_FOUND,
InternalError: fmt.Errorf("failed to get tree of commit '%v': %v", commit.Hash, err),
}
}
count := 0

Expand Down Expand Up @@ -369,13 +369,13 @@ func (provider *repositoryProvider) snapshot(repository *git.Repository, commit

if err != nil {
if errors.Is(err, dotgit.ErrPackfileNotFound) {
return 0, util.ErrorWithCode{
return 0, &util.ErrorWithCode{
StatusCode: util.ERROR_BAD_CLONE_GIT,
InternalError: err,
}
}
if errors.Is(err, plumbing.ErrObjectNotFound) {
return 0, util.ErrorWithCode{
return 0, &util.ErrorWithCode{
StatusCode: util.ERROR_NO_REVISION,
InternalError: err,
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/urfave/cli/v2"
)

const VERSION = "1.19"
const VERSION = "1.20"

func main() {
cli.AppHelpTemplate =
Expand Down

0 comments on commit 7ca6906

Please sign in to comment.