Skip to content

Commit

Permalink
ssh: fix --sparse mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Dec 27, 2024
1 parent b852beb commit 564c120
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/serve/sshserver/command_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (s *Server) TagPush(e *Session, tagName string, oldRev, newRev plumbing.Has
Language: e.Getenv("LANG"),
}
if tag != nil && tag.Hash != command.OldRev {
return e.ExitFormat(409, e.W("tag is updated, please update and try again")) //nolint:govet
return e.ExitFormat(409, "%s", e.W("tag is updated, please update and try again")) //nolint:govet
}
command.UpdateStats(e.Getenv("ZETA_OBJECTS_STATS"))
rr, err := s.open(e)
Expand Down Expand Up @@ -228,7 +228,7 @@ func (s *Server) BranchPush(e *Session, branchName string, oldRev, newRev plumbi
Language: e.Getenv("LANG"),
}
if oldBranch != nil && oldBranch.Hash != command.OldRev {
return e.ExitFormat(409, e.W("branch is updated, please update and try again")) //nolint:govet
return e.ExitFormat(409, "%s", e.W("branch is updated, please update and try again")) //nolint:govet
}
command.UpdateStats(e.Getenv("ZETA_OBJECTS_STATS"))
rr, err := s.open(e)
Expand Down
2 changes: 1 addition & 1 deletion pkg/serve/sshserver/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (e *Session) ExitError(err error) int {
return 409
default:
logrus.Errorf("access %s/%s internal server error: %v", e.NamespacePath, e.RepoPath, err)
e.WriteError(e.W("internal server error")) //nolint:govet
e.WriteError("%s", e.W("internal server error")) //nolint:govet
}
return 500
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/transport/ssh/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ func (c *client) FetchMetadata(ctx context.Context, target plumbing.Hash, opts *
if opts.Depth != 0 {
psArgs = append(psArgs, "--depth="+strconv.Itoa(opts.Depth))
}
if len(opts.Sparses) != 0 {
psArgs = append(psArgs, "--sparse")
}
commandArgs := strings.Join(psArgs, " ")
cmd, err := c.NewBaseCommand(ctx)
if err != nil {
Expand Down

0 comments on commit 564c120

Please sign in to comment.