mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-27 23:08:02 +02:00
abbrev all commits to length 40 for consistency
This commit is contained in:
parent
4805db7d97
commit
a3885e8ea3
@ -435,7 +435,7 @@ func (self *CommitLoader) getLogCmd(opts GetCommitsOptions) oscommands.ICmdObj {
|
|||||||
allFlag,
|
allFlag,
|
||||||
prettyFormat,
|
prettyFormat,
|
||||||
limitFlag,
|
limitFlag,
|
||||||
20,
|
40,
|
||||||
filterFlag,
|
filterFlag,
|
||||||
),
|
),
|
||||||
).DontLog()
|
).DontLog()
|
||||||
|
@ -57,7 +57,7 @@ func TestGetCommits(t *testing.T) {
|
|||||||
opts: GetCommitsOptions{RefName: "HEAD", IncludeRebaseCommits: false},
|
opts: GetCommitsOptions{RefName: "HEAD", IncludeRebaseCommits: false},
|
||||||
runner: oscommands.NewFakeRunner(t).
|
runner: oscommands.NewFakeRunner(t).
|
||||||
Expect(`git merge-base "HEAD" "HEAD"@{u}`, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164", nil).
|
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{},
|
expectedCommits: []*models.Commit{},
|
||||||
expectedError: nil,
|
expectedError: nil,
|
||||||
@ -71,7 +71,7 @@ func TestGetCommits(t *testing.T) {
|
|||||||
// here it's seeing which commits are yet to be pushed
|
// here it's seeing which commits are yet to be pushed
|
||||||
Expect(`git merge-base "HEAD" "HEAD"@{u}`, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164", nil).
|
Expect(`git merge-base "HEAD" "HEAD"@{u}`, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164", nil).
|
||||||
// here it's actually getting all the commits in a formatted form, one per line
|
// 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'
|
// 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),
|
Expect(`git merge-base "HEAD" "master"`, "26c07b1ab33860a1a7591a0638f9925ccf497ffa", nil),
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit
|
|||||||
filterPathArg = fmt.Sprintf(" --follow -- %s", self.cmd.Quote(filterPath))
|
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
|
onlyObtainedNewReflogCommits := false
|
||||||
err := cmdObj.RunAndProcessLines(func(line string) (bool, error) {
|
err := cmdObj.RunAndProcessLines(func(line string) (bool, error) {
|
||||||
fields := strings.SplitN(line, " ", 3)
|
fields := strings.SplitN(line, " ", 3)
|
||||||
|
@ -33,7 +33,7 @@ func TestGetReflogCommits(t *testing.T) {
|
|||||||
{
|
{
|
||||||
testName: "no reflog entries",
|
testName: "no reflog entries",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
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,
|
lastReflogCommit: nil,
|
||||||
expectedCommits: []*models.Commit{},
|
expectedCommits: []*models.Commit{},
|
||||||
@ -43,7 +43,7 @@ func TestGetReflogCommits(t *testing.T) {
|
|||||||
{
|
{
|
||||||
testName: "some reflog entries",
|
testName: "some reflog entries",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
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,
|
lastReflogCommit: nil,
|
||||||
expectedCommits: []*models.Commit{
|
expectedCommits: []*models.Commit{
|
||||||
@ -84,7 +84,7 @@ func TestGetReflogCommits(t *testing.T) {
|
|||||||
{
|
{
|
||||||
testName: "some reflog entries where last commit is given",
|
testName: "some reflog entries where last commit is given",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
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{
|
lastReflogCommit: &models.Commit{
|
||||||
Sha: "c3c4b66b64c97ffeecde",
|
Sha: "c3c4b66b64c97ffeecde",
|
||||||
@ -106,7 +106,7 @@ func TestGetReflogCommits(t *testing.T) {
|
|||||||
{
|
{
|
||||||
testName: "when passing filterPath",
|
testName: "when passing filterPath",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
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{
|
lastReflogCommit: &models.Commit{
|
||||||
Sha: "c3c4b66b64c97ffeecde",
|
Sha: "c3c4b66b64c97ffeecde",
|
||||||
@ -129,7 +129,7 @@ func TestGetReflogCommits(t *testing.T) {
|
|||||||
{
|
{
|
||||||
testName: "when command returns error",
|
testName: "when command returns error",
|
||||||
runner: oscommands.NewFakeRunner(t).
|
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,
|
lastReflogCommit: nil,
|
||||||
filterPath: "",
|
filterPath: "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user