I want to write a tool for automerging changes from master into feature branches. I use two tools here, a branchtool which creates new feature branches, the users are able to enable or disable automerge for their feature branches and a automergetool which, runs as a service on the server and needs to read this information and run the merge process.
During my research i discovered GitRef.Statuses and "GitStatus"-Class, which "contains the metadata of a service/extension posting a status" (official microsoft description). GitStatus looks very interesting, because i can define own Statuses and set a state on it. The Problem is, i didn't found anything about it - except MS-Pages, which are not very far-reaching. i don't know whether my procedure is correct or not. So how can i use it? My intention is this one:
public Branch AddStatusToBranch(Branch branch) { if (!(branch.GitBranch.Statuses is List<GitStatus> bGitStatuses)) bGitStatuses = new List<GitStatus>(); _status = null; if ((_status = bGitStatuses.Find(s => s.Context.Genre == _genre)) != null) { return branch; } else { _status = new GitStatus() { Context = new GitStatusContext() { Genre = _genre, Name = branch.DisplayName } }; bGitStatuses.Add(_status); branch.GitBranch.Statuses = bGitStatuses; return branch; } } Maybe there is another - a simpler - way to transport and save this information (which shall not be lost, just when set through the tool or a pullrequest or deletion of this branch happened).
So how to use GitStatus correct?
Kind Regards Mirko