Procházet zdrojové kódy

Remove redundant nil check in `WalkGitLog` (#26773)

From the Go specification:

> "1. For a nil slice, the number of iterations is 0."
https://go.dev/ref/spec#For_range

Therefore, an additional nil check for before the loop is unnecessary.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
tags/v1.21.0-rc0
Eng Zer Jun před 10 měsíci
rodič
revize
ad3cbbc3b1
Žádný účet není propojen s e-mailovou adresou tvůrce revize
1 změnil soubory, kde provedl 15 přidání a 17 odebrání
  1. 15
    17
      modules/git/log_name_status.go

+ 15
- 17
modules/git/log_name_status.go Zobrazit soubor

@@ -374,27 +374,25 @@ heaploop:
break heaploop
}
parentRemaining.Remove(current.CommitID)
if current.Paths != nil {
for i, found := range current.Paths {
if !found {
continue
for i, found := range current.Paths {
if !found {
continue
}
changed[i] = false
if results[i] == "" {
results[i] = current.CommitID
if err := repo.LastCommitCache.Put(headRef, path.Join(treepath, paths[i]), current.CommitID); err != nil {
return nil, err
}
changed[i] = false
if results[i] == "" {
results[i] = current.CommitID
if err := repo.LastCommitCache.Put(headRef, path.Join(treepath, paths[i]), current.CommitID); err != nil {
delete(path2idx, paths[i])
remaining--
if results[0] == "" {
results[0] = current.CommitID
if err := repo.LastCommitCache.Put(headRef, treepath, current.CommitID); err != nil {
return nil, err
}
delete(path2idx, paths[i])
delete(path2idx, "")
remaining--
if results[0] == "" {
results[0] = current.CommitID
if err := repo.LastCommitCache.Put(headRef, treepath, current.CommitID); err != nil {
return nil, err
}
delete(path2idx, "")
remaining--
}
}
}
}

Načítá se…
Zrušit
Uložit