Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions image/git-init/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func Fetch(logger *zap.SugaredLogger, spec FetchSpec) error {
return fmt.Errorf("error parsing %s after fetching refspec %s", checkoutParam, spec.Refspec)
}

if _, err := run(logger, "", "checkout", "-f", checkoutParam); err != nil {
if _, err := run(logger, "", "checkout", "-f", checkoutParam, "--"); err != nil {
return err
}

Expand All @@ -208,15 +208,15 @@ func Fetch(logger *zap.SugaredLogger, spec FetchSpec) error {

// ShowCommit calls "git show ..." to get the commit SHA for the given revision
func ShowCommit(logger *zap.SugaredLogger, revision, path string) (string, error) {
output, err := run(logger, path, "show", "-q", "--pretty=format:%H", revision)
output, err := run(logger, path, "show", "-q", "--pretty=format:%H", revision, "--")
if err != nil {
return "", err
}
return strings.TrimSuffix(output, "\n"), nil
}

func showRef(logger *zap.SugaredLogger, revision, path string) (string, error) {
output, err := run(logger, path, "show", "-q", "--pretty=format:%D", revision)
output, err := run(logger, path, "show", "-q", "--pretty=format:%D", revision, "--")
if err != nil {
return "", err
}
Expand Down