From 0c07963a2e76c54cbde14dc2da20450454f0e286 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 11 Jul 2023 12:06:34 +0200 Subject: [PATCH] Store full sha in branch model The model will be used for logic, so the full hash is needed there; a shortened hash of 8 characters might be too short to be unique in very large repos. If some view wants to display a shortened hash, it should truncate it at presentation time. --- pkg/commands/git_commands/branch_loader.go | 2 +- pkg/gui/presentation/branches.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/commands/git_commands/branch_loader.go b/pkg/commands/git_commands/branch_loader.go index 094354cad..b7e55a910 100644 --- a/pkg/commands/git_commands/branch_loader.go +++ b/pkg/commands/git_commands/branch_loader.go @@ -171,7 +171,7 @@ var branchFields = []string{ "upstream:short", "upstream:track", "subject", - fmt.Sprintf("objectname:short=%d", utils.COMMIT_HASH_SHORT_SIZE), + "objectname", } // Obtain branch information from parsed line output of getRawBranches() diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go index 849a56eba..6d4620238 100644 --- a/pkg/gui/presentation/branches.go +++ b/pkg/gui/presentation/branches.go @@ -71,7 +71,7 @@ func getBranchDisplayStrings( } if fullDescription || userConfig.Gui.ShowBranchCommitHash { - res = append(res, b.CommitHash) + res = append(res, utils.ShortSha(b.CommitHash)) } res = append(res, coloredName)