From d0f001e7990ac538d529d7d65f814967eb450b68 Mon Sep 17 00:00:00 2001 From: UnaffiliatedCode Date: Fri, 2 Feb 2024 08:39:15 -0500 Subject: [PATCH] cmd/gorelease: migrated `git status --porcelain` to `git diff` The expectation of this application is that it is to be utilized in release pipelines. Due to this expectation, pipelines utilize volume mounting to transfer artifacts (untracked files) across different jobs (specifically referring to GITLAB here). This is a problem because git status --porcelain checks for untracked files and returns them as a list. This causes this pipeline to fail unexpectedly. In testing, `git reset --hard` will not remove these, while a `git clean -fdx` will correctly remove these files. I would recommend that in a follow-up commit there is an update to the available args for this cmd to control if untracked files are to be included or not (eg: --untracked) --- cmd/gorelease/gorelease.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/gorelease/gorelease.go b/cmd/gorelease/gorelease.go index e15532352..68037482f 100644 --- a/cmd/gorelease/gorelease.go +++ b/cmd/gorelease/gorelease.go @@ -1507,7 +1507,7 @@ func shortRetractionRationale(rationales []string) (string, bool) { // changes. func hasGitUncommittedChanges(dir string) (bool, error) { stdout := &bytes.Buffer{} - cmd := exec.Command("git", "status", "--porcelain") + cmd := exec.Command("git", "diff") cmd.Dir = dir cmd.Stdout = stdout if err := cmd.Run(); err != nil {