mirror of
1
Fork 0
forgejo/models/git
Lunny Xiao 4eb2a29910
Improve ObjectFormat interface (#28496)
The 4 functions are duplicated, especially as interface methods. I think
we just need to keep `MustID` the only one and remove other 3.

```
MustID(b []byte) ObjectID
MustIDFromString(s string) ObjectID
NewID(b []byte) (ObjectID, error)
NewIDFromString(s string) (ObjectID, error)
```

Introduced the new interfrace method `ComputeHash` which will replace
the interface `HasherInterface`. Now we don't need to keep two
interfaces.

Reintroduced `git.NewIDFromString` and `git.MustIDFromString`. The new
function will detect the hash length to decide which objectformat of it.
If it's 40, then it's SHA1. If it's 64, then it's SHA256. This will be
right if the commitID is a full one. So the parameter should be always a
full commit id.

@AdamMajer Please review.
2023-12-19 07:20:47 +00:00
..
branch.go Also sync DB branches on push if necessary (#28361) 2023-12-09 13:30:56 +00:00
branch_list.go Second part of refactor `db.Find` (#28194) 2023-12-11 16:56:48 +08:00
branch_test.go Improve ObjectFormat interface (#28496) 2023-12-19 07:20:47 +00:00
commit_status.go Improve ObjectFormat interface (#28496) 2023-12-19 07:20:47 +00:00
commit_status_test.go Restore warning commit status (#27504) 2023-10-08 22:16:06 +00:00
lfs.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 2023-12-07 15:27:36 +08:00
lfs_lock.go Introduce path Clean/Join helper functions (#23495) 2023-03-21 16:02:49 -04:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
protected_banch_list_test.go Fix branch protection priority (#24045) 2023-04-11 13:22:49 -04:00
protected_branch.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 2023-12-07 15:27:36 +08:00
protected_branch_list.go Sync branches into databases (#22743) 2023-06-29 10:03:20 +00:00
protected_branch_test.go Supports wildcard protected branch (#20825) 2023-01-16 16:00:22 +08:00
protected_tag.go Use context parameter in models/git (#22367) 2023-01-09 11:50:54 +08:00
protected_tag_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00