From 38994c110a1cc457c708da89a43495e5ca6ce7b3 Mon Sep 17 00:00:00 2001 From: ltdk Date: Mon, 24 Oct 2022 09:16:45 -0400 Subject: [PATCH 1/3] Use right syntax for symbolic-ref command --- modules/doctor/heads.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/doctor/heads.go b/modules/doctor/heads.go index 7f3b2a8a02963..1f52afd8053bf 100644 --- a/modules/doctor/heads.go +++ b/modules/doctor/heads.go @@ -49,7 +49,7 @@ func synchronizeRepoHeads(ctx context.Context, logger log.Logger, autofix bool) } // otherwise, let's try fixing HEAD - err := git.NewCommand(ctx, "symbolic-ref").AddDashesAndList("HEAD", repo.DefaultBranch).Run(runOpts) + err := git.NewCommand(ctx, "symbolic-ref").AddDashesAndList("HEAD", "refs/heads/" + repo.DefaultBranch).Run(runOpts) if err != nil { logger.Warn("Failed to fix HEAD for %s/%s: %v", repo.OwnerName, repo.Name, err) return nil From c383566886243d66c9b46b7fc1bf0b21f946b25d Mon Sep 17 00:00:00 2001 From: ltdk Date: Mon, 24 Oct 2022 17:56:08 -0400 Subject: [PATCH 2/3] make fmt --- modules/doctor/heads.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/doctor/heads.go b/modules/doctor/heads.go index 1f52afd8053bf..2aaf5c681cc43 100644 --- a/modules/doctor/heads.go +++ b/modules/doctor/heads.go @@ -49,7 +49,7 @@ func synchronizeRepoHeads(ctx context.Context, logger log.Logger, autofix bool) } // otherwise, let's try fixing HEAD - err := git.NewCommand(ctx, "symbolic-ref").AddDashesAndList("HEAD", "refs/heads/" + repo.DefaultBranch).Run(runOpts) + err := git.NewCommand(ctx, "symbolic-ref").AddDashesAndList("HEAD", "refs/heads/"+repo.DefaultBranch).Run(runOpts) if err != nil { logger.Warn("Failed to fix HEAD for %s/%s: %v", repo.OwnerName, repo.Name, err) return nil From 51f13f058a1f3a28b9a4e79ca086869b9048e1da Mon Sep 17 00:00:00 2001 From: ltdk Date: Tue, 25 Oct 2022 22:59:13 -0400 Subject: [PATCH 3/3] Use git.BranchPrefix instead of string --- modules/doctor/heads.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/doctor/heads.go b/modules/doctor/heads.go index 2aaf5c681cc43..33efc27a222ac 100644 --- a/modules/doctor/heads.go +++ b/modules/doctor/heads.go @@ -49,7 +49,7 @@ func synchronizeRepoHeads(ctx context.Context, logger log.Logger, autofix bool) } // otherwise, let's try fixing HEAD - err := git.NewCommand(ctx, "symbolic-ref").AddDashesAndList("HEAD", "refs/heads/"+repo.DefaultBranch).Run(runOpts) + err := git.NewCommand(ctx, "symbolic-ref").AddDashesAndList("HEAD", git.BranchPrefix+repo.DefaultBranch).Run(runOpts) if err != nil { logger.Warn("Failed to fix HEAD for %s/%s: %v", repo.OwnerName, repo.Name, err) return nil