{"action":"created","issue":{"url":"https://api.github.com/repos/gitextensions/gitextensions/issues/4556","repository_url":"https://api.github.com/repos/gitextensions/gitextensions","labels_url":"https://api.github.com/repos/gitextensions/gitextensions/issues/4556/labels{/name}","comments_url":"https://api.github.com/repos/gitextensions/gitextensions/issues/4556/comments","events_url":"https://api.github.com/repos/gitextensions/gitextensions/issues/4556/events","html_url":"https://github.com/gitextensions/gitextensions/pull/4556","id":301937370,"number":4556,"title":"Formalise type for object IDs","user":{"login":"drewnoakes","id":350947,"avatar_url":"https://avatars2.githubusercontent.com/u/350947?v=4","gravatar_id":"","url":"https://api.github.com/users/drewnoakes","html_url":"https://github.com/drewnoakes","followers_url":"https://api.github.com/users/drewnoakes/followers","following_url":"https://api.github.com/users/drewnoakes/following{/other_user}","gists_url":"https://api.github.com/users/drewnoakes/gists{/gist_id}","starred_url":"https://api.github.com/users/drewnoakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewnoakes/subscriptions","organizations_url":"https://api.github.com/users/drewnoakes/orgs","repos_url":"https://api.github.com/users/drewnoakes/repos","events_url":"https://api.github.com/users/drewnoakes/events{/privacy}","received_events_url":"https://api.github.com/users/drewnoakes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-03-02T23:24:22Z","updated_at":"2018-03-16T16:34:12Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gitextensions/gitextensions/pulls/4556","html_url":"https://github.com/gitextensions/gitextensions/pull/4556","diff_url":"https://github.com/gitextensions/gitextensions/pull/4556.diff","patch_url":"https://github.com/gitextensions/gitextensions/pull/4556.patch"},"body":"Git object IDs are (currently) SHA1 hashes.\r\n\r\nIn GE, these are modelled as strings.\r\n\r\nStrings are convenient, but they have some downsides:\r\n\r\n- There's no guarantee that a string is a valid hash and errors from invalid values likely occur long after the invalid value was introduced\r\n- They don't carry much semantic power, and when you see a string id in code it's not clear whether it might also be `HEAD`, a branch name, or something more exotic\r\n- There are multiple nil values (`null`, empty string, whitespace)\r\n- We're not able to add members to values without polluting all strings (i.e. the `IsArtificial()` extension method)\r\n- They take up more memory than needed (80 bytes vs 20 bytes for a `byte[]`)\r\n\r\nThe git codebase [underwent a transition](https://lwn.net/Articles/715736/) from `unsigned char[20]` to a new `object_id` type. This PR is a mirror of that initiative.\r\n\r\nThis PR proposes a new class, `ObjectId` that holds an immutable SHA-1 hash value. It explores using this type in a few APIs such as:\r\n\r\n- `CommitData.Guid`\r\n- `GitRevision`'s constructor parameter\r\n- `GitModule.RevParse` and `GitModeul.GetMergeBase` return values\r\n\r\nThis type can be introduced incrementally. One of the challenges of its use is that certain `string` values accept non-SHA-1 values such as named refs.\r\n\r\nFurthermore, now that SHA-1 has been proven insecure, an initiative is underway to introduce new hash functions to git:\r\n\r\n- https://www.kernel.org/pub/software/scm/git/docs/technical/hash-function-transition.html\r\n- https://lwn.net/Articles/715716/\r\n- https://stackoverflow.com/a/47838703/24874\r\n\r\n`ObjectId` can be extended in future to support multiple hash functions."},"comment":{"url":"https://api.github.com/repos/gitextensions/gitextensions/issues/comments/373770545","html_url":"https://github.com/gitextensions/gitextensions/pull/4556#issuecomment-373770545","issue_url":"https://api.github.com/repos/gitextensions/gitextensions/issues/4556","id":373770545,"user":{"login":"drewnoakes","id":350947,"avatar_url":"https://avatars2.githubusercontent.com/u/350947?v=4","gravatar_id":"","url":"https://api.github.com/users/drewnoakes","html_url":"https://github.com/drewnoakes","followers_url":"https://api.github.com/users/drewnoakes/followers","following_url":"https://api.github.com/users/drewnoakes/following{/other_user}","gists_url":"https://api.github.com/users/drewnoakes/gists{/gist_id}","starred_url":"https://api.github.com/users/drewnoakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewnoakes/subscriptions","organizations_url":"https://api.github.com/users/drewnoakes/orgs","repos_url":"https://api.github.com/users/drewnoakes/repos","events_url":"https://api.github.com/users/drewnoakes/events{/privacy}","received_events_url":"https://api.github.com/users/drewnoakes/received_events","type":"User","site_admin":false},"created_at":"2018-03-16T16:34:12Z","updated_at":"2018-03-16T16:34:12Z","author_association":"CONTRIBUTOR","body":"Some future opportunities for ObjectId include:\r\n\r\n- `CommitData.ParentGuids`\r\n- `CommitData.ChildrenGuids`\r\n- `ILinkFactory.CreateCommitLink`\r\n\r\n`CommitData` changes are best made after #4641.\r\n"}}
{"actor":{"display_login":"drewnoakes"}}