From 4a67b0b09a54d555736205470e47c6211d99d273 Mon Sep 17 00:00:00 2001 From: aram price Date: Thu, 17 Oct 2024 16:41:44 -0700 Subject: [PATCH] Fix specs broken by https://github.com/cloudfoundry/bosh-cli/pull/668 --- releasedir/git_repo.go | 2 +- releasedir/git_repo_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/releasedir/git_repo.go b/releasedir/git_repo.go index 543b44791..4a6f5fa0e 100644 --- a/releasedir/git_repo.go +++ b/releasedir/git_repo.go @@ -52,7 +52,7 @@ releases/**/*.tgz func (r FSGitRepo) LastCommitSHA() (string, error) { cmd := boshsys.Command{ Name: "git", - Args: []string{"rev-parse", "--short", "HEAD"}, + Args: []string{"rev-parse", "--porcelain=1", "HEAD"}, WorkingDir: r.dirPath, } stdout, stderr, _, err := r.runner.RunComplexCommand(cmd) diff --git a/releasedir/git_repo_test.go b/releasedir/git_repo_test.go index 5fb778aa6..532010827 100644 --- a/releasedir/git_repo_test.go +++ b/releasedir/git_repo_test.go @@ -69,7 +69,7 @@ releases/**/*.tgz }) Describe("LastCommitSHA", func() { - cmd := "git rev-parse --short HEAD" + cmd := "git rev-parse --porcelain=1 HEAD" It("returns last commit", func() { cmdRunner.AddCmdResult(cmd, fakesys.FakeCmdResult{ @@ -81,7 +81,7 @@ releases/**/*.tgz Expect(cmdRunner.RunComplexCommands).To(Equal([]boshsys.Command{{ Name: "git", - Args: []string{"rev-parse", "--short", "HEAD"}, + Args: []string{"rev-parse", "--porcelain=1", "HEAD"}, WorkingDir: "/dir", }})) }) @@ -91,7 +91,7 @@ releases/**/*.tgz Expect(err).ToNot(HaveOccurred()) cmdRunner.AddCmdResult(cmd, fakesys.FakeCmdResult{ Stderr: "fatal: Not a git repository: '/dir/.git'\n", - Error: errors.New("not a git repo (--short HEAD)"), + Error: errors.New("not a git repo (--porcelain=1 HEAD)"), }) cmdRunner.AddCmdResult("git rev-parse --git-dir", fakesys.FakeCmdResult{ Stderr: "fatal: Not a git repository: '/dir/.git'\n", @@ -123,7 +123,7 @@ releases/**/*.tgz }) Describe("MustNotBeDirty", func() { - cmd := "git status --short" + cmd := "git status --porcelain=1" It("returns false if there are no changes", func() { cmdRunner.AddCmdResult(cmd, fakesys.FakeCmdResult{Stdout: ""}) @@ -133,7 +133,7 @@ releases/**/*.tgz Expect(cmdRunner.RunComplexCommands).To(Equal([]boshsys.Command{{ Name: "git", - Args: []string{"status", "--short"}, + Args: []string{"status", "--porcelain=1"}, WorkingDir: "/dir", }})) }) @@ -158,7 +158,7 @@ releases/**/*.tgz Expect(err).ToNot(HaveOccurred()) cmdRunner.AddCmdResult(cmd, fakesys.FakeCmdResult{ Stderr: "fatal: not a git repository: '/dir/.git'\n", - Error: errors.New("not a git repo (--short HEAD)"), + Error: errors.New("not a git repo (--porcelain=1 HEAD)"), }) cmdRunner.AddCmdResult("git rev-parse --git-dir", fakesys.FakeCmdResult{ Stderr: "fatal: not a git repository: '/dir/.git'\n",