summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-02-26 16:09:18 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commita3885e8ea34b44322234e2b2645b51994a1a73fb (patch)
tree7a6e3380fe79825973039587b35faef0084bfd91 /pkg/commands
parent4805db7d976af59efe97e1e3cc13ad0fc581c9c0 (diff)
abbrev all commits to length 40 for consistency
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/loaders/commits.go2
-rw-r--r--pkg/commands/loaders/commits_test.go4
-rw-r--r--pkg/commands/loaders/reflog_commits.go2
-rw-r--r--pkg/commands/loaders/reflog_commits_test.go10
4 files changed, 9 insertions, 9 deletions
diff --git a/pkg/commands/loaders/commits.go b/pkg/commands/loaders/commits.go
index ea54a4e76..187a13bb0 100644
--- a/pkg/commands/loaders/commits.go
+++ b/pkg/commands/loaders/commits.go
@@ -435,7 +435,7 @@ func (self *CommitLoader) getLogCmd(opts GetCommitsOptions) oscommands.ICmdObj {
allFlag,
prettyFormat,
limitFlag,
- 20,
+ 40,
filterFlag,
),
).DontLog()
diff --git a/pkg/commands/loaders/commits_test.go b/pkg/commands/loaders/commits_test.go
index 23406abcc..ff406abaf 100644
--- a/pkg/commands/loaders/commits_test.go
+++ b/pkg/commands/loaders/commits_test.go
@@ -57,7 +57,7 @@ func TestGetCommits(t *testing.T) {
opts: GetCommitsOptions{RefName: "HEAD", IncludeRebaseCommits: false},
runner: oscommands.NewFakeRunner(t).
Expect(`git merge-base "HEAD" "HEAD"@{u}`, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164", nil).
- Expect(`git log "HEAD" --topo-order --oneline --pretty=format:"%H|%at|%aN|%d|%p|%s" --abbrev=20`, "", nil),
+ Expect(`git log "HEAD" --topo-order --oneline --pretty=format:"%H|%at|%aN|%d|%p|%s" --abbrev=40`, "", nil),
expectedCommits: []*models.Commit{},
expectedError: nil,
@@ -71,7 +71,7 @@ func TestGetCommits(t *testing.T) {
// here it's seeing which commits are yet to be pushed
Expect(`git merge-base "HEAD" "HEAD"@{u}`, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164", nil).
// here it's actually getting all the commits in a formatted form, one per line
- Expect(`git log "HEAD" --topo-order --oneline --pretty=format:"%H|%at|%aN|%d|%p|%s" --abbrev=20`, commitsOutput, nil).
+ Expect(`git log "HEAD" --topo-order --oneline --pretty=format:"%H|%at|%aN|%d|%p|%s" --abbrev=40`, commitsOutput, nil).
// here it's seeing where our branch diverged from the master branch so that we can mark that commit and parent commits as 'merged'
Expect(`git merge-base "HEAD" "master"`, "26c07b1ab33860a1a7591a0638f9925ccf497ffa", nil),
diff --git a/pkg/commands/loaders/reflog_commits.go b/pkg/commands/loaders/reflog_commits.go
index dc1a4ac15..849c96f50 100644
--- a/pkg/commands/loaders/reflog_commits.go
+++ b/pkg/commands/loaders/reflog_commits.go
@@ -32,7 +32,7 @@ func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit
filterPathArg = fmt.Sprintf(" --follow -- %s", self.cmd.Quote(filterPath))
}
- cmdObj := self.cmd.New(fmt.Sprintf(`git log -g --abbrev=20 --format="%%h %%ct %%gs"%s`, filterPathArg)).DontLog()
+ cmdObj := self.cmd.New(fmt.Sprintf(`git log -g --abbrev=40 --format="%%h %%ct %%gs"%s`, filterPathArg)).DontLog()
onlyObtainedNewReflogCommits := false
err := cmdObj.RunAndProcessLines(func(line string) (bool, error) {
fields := strings.SplitN(line, " ", 3)
diff --git a/pkg/commands/loaders/reflog_commits_test.go b/pkg/commands/loaders/reflog_commits_test.go
index 0e00ca3e5..e3f1cbeb8 100644
--- a/pkg/commands/loaders/reflog_commits_test.go
+++ b/pkg/commands/loaders/reflog_commits_test.go
@@ -33,7 +33,7 @@ func TestGetReflogCommits(t *testing.T) {
{
testName: "no reflog entries",
runner: oscommands.NewFakeRunner(t).
- Expect(`git log -g --abbrev=20 --format="%h %ct %gs"`, "", nil),
+ Expect(`git log -g --abbrev=40 --format="%h %ct %gs"`, "", nil),
lastReflogCommit: nil,
expectedCommits: []*models.Commit{},
@@ -43,7 +43,7 @@ func TestGetReflogCommits(t *testing.T) {
{
testName: "some reflog entries",
runner: oscommands.NewFakeRunner(t).
- Expect(`git log -g --abbrev=20 --format="%h %ct %gs"`, reflogOutput, nil),
+ Expect(`git log -g --abbrev=40 --format="%h %ct %gs"`, reflogOutput, nil),
lastReflogCommit: nil,
expectedCommits: []*models.Commit{
@@ -84,7 +84,7 @@ func TestGetReflogCommits(t *testing.T) {
{
testName: "some reflog entries where last commit is given",
runner: oscommands.NewFakeRunner(t).
- Expect(`git log -g --abbrev=20 --format="%h %ct %gs"`, reflogOutput, nil),
+ Expect(`git log -g --abbrev=40 --format="%h %ct %gs"`, reflogOutput, nil),
lastReflogCommit: &models.Commit{
Sha: "c3c4b66b64c97ffeecde",
@@ -106,7 +106,7 @@ func TestGetReflogCommits(t *testing.T) {
{
testName: "when passing filterPath",
runner: oscommands.NewFakeRunner(t).
- Expect(`git log -g --abbrev=20 --format="%h %ct %gs" --follow -- "path"`, reflogOutput, nil),
+ Expect(`git log -g --abbrev=40 --format="%h %ct %gs" --follow -- "path"`, reflogOutput, nil),
lastReflogCommit: &models.Commit{
Sha: "c3c4b66b64c97ffeecde",
@@ -129,7 +129,7 @@ func TestGetReflogCommits(t *testing.T) {
{
testName: "when command returns error",
runner: oscommands.NewFakeRunner(t).
- Expect(`git log -g --abbrev=20 --format="%h %ct %gs"`, "", errors.New("haha")),
+ Expect(`git log -g --abbrev=40 --format="%h %ct %gs"`, "", errors.New("haha")),
lastReflogCommit: nil,
filterPath: "",