Skip to content

Commit

Permalink
staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjennings committed Oct 27, 2024
1 parent 34d3d9b commit 6f7f7aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (idx *Index) addFromWorkTree(f *FileStatus) error {
func (idx *Index) updateItem(i *indexItem) error {
found := false
for k, v := range idx.items {
if bytes.Compare(v.Name, i.Name) == 0 {
if bytes.Equal(v.Name, i.Name) {
idx.items[k] = i
found = true
}
Expand Down
3 changes: 3 additions & 0 deletions object.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ func CommittedFilesForBranchHead(name string) (*FfileSet, error) {
return nil, err
}
fs, err := CommittedFiles(commitSha)
if err != nil {
return nil, err
}
return NewFfileSet(fs, nil, nil)
}

Expand Down
2 changes: 1 addition & 1 deletion sha.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ShaFromHexString(s string) (Sha, error) {
}

func (s Sha) Matches(ss Sha) bool {
return bytes.Compare(s.hash[:], ss.hash[:]) == 0
return bytes.Equal(s.hash[:], ss.hash[:])
}

func (s Sha) String() string {
Expand Down
3 changes: 3 additions & 0 deletions switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func newSwitchBranchDelta(name string) (*switchBranchDelta, error) {
// get all files in working directory, index and current commit with the
// index and wd statuses set.
curFiles, err := CurrentStatus()
if err != nil {
return nil, err
}

// get all the files in the branch HEAD commit being switched to
commitFiles, err := CommittedFilesForBranchHead(name)
Expand Down
1 change: 0 additions & 1 deletion test_assets/test.file

This file was deleted.

0 comments on commit 6f7f7aa

Please sign in to comment.