mirror of
1
Fork 0
forgejo/services/pull
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
..
check.go Abstract hash function usage (#28138) 2023-12-13 21:02:00 +00:00
check_test.go Replace assert.Fail with assert.FailNow (#27578) 2023-10-11 11:02:24 +00:00
comment.go Delete `issue_service.CreateComment` (#26298) 2023-08-04 13:34:34 +00:00
commit_status.go Fix pull request check list is limited (#26179) 2023-07-31 02:21:09 +00:00
edits.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +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
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
merge.go Abstract hash function usage (#28138) 2023-12-13 21:02:00 +00:00
merge_merge.go Refactor and tidy-up the merge/update branch code (#22568) 2023-03-07 15:07:35 -05:00
merge_prepare.go Refactor merge/update git command calls (#23366) 2023-03-09 09:48:52 -06:00
merge_rebase.go Merge message template support for rebase without merge commit (#22669) 2023-05-22 09:01:46 +08:00
merge_squash.go Improve squash merge commit author and co-author with private emails (#22977) 2023-03-09 22:17:04 -05:00
merge_test.go Support template for merge message description (#22248) 2022-12-29 14:40:20 +02:00
patch.go Improve ObjectFormat interface (#28496) 2023-12-19 07:20:47 +00:00
patch_unmerged.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
pull.go Adjust object format interface (#28469) 2023-12-17 11:56:08 +00:00
pull_test.go Support template for merge message description (#22248) 2022-12-29 14:40:20 +02:00
review.go Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
temp_repo.go Adjust object format interface (#28469) 2023-12-17 11:56:08 +00:00
update.go Sync branches into databases (#22743) 2023-06-29 10:03:20 +00:00
update_rebase.go Refactor and tidy-up the merge/update branch code (#22568) 2023-03-07 15:07:35 -05:00