vanBassum / Wakatime.Unity

A Wakatime plugin for Unity
MIT License
41 stars 7 forks source link

A mistake occurred when retrieving branch name from git repository via File IO Implementation #11

Closed ExerciseBook closed 1 year ago

ExerciseBook commented 1 year ago

https://github.com/vanBassum/Wakatime.Unity/blob/08f29761573924b7d392f8ab19181a39fc47fa52/Editor/HeartbeatCollector.cs#L184

A branch name contains / is acceptable.

e.g: https://github.com/dotnet/runtime

image

assign to: @buger404


When we read .git/HEAD, there are a few situations

  1. we got ref: refs/heads/master. A reference name of a commit
  2. we got 08f29761573924b7d392f8ab19181a39fc47fa52. A plain commit id

Maybe more? I am not sure.

buger404 commented 1 year ago

Thanks for reminding, I'll try to fix the problem later. I should consider it more comprehensively.

vanBassum commented 1 year ago

Ah, I was afraid of these type of situations. Thats why I didn't remove the old solution. I guess its more robust to use either the git cli or a git .net package

buger404 commented 1 year ago

I created a new pull request #12 to fix this issue.

vanBassum commented 1 year ago

I've merged your pull request, therefore this issue is resolved.