- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.2k
 
Description
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Clicking on links for branches and tags in the commit info no longer navigates to the revision for that branch or tag.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
- In the revision grid, select a revision that shows a branch in "Contained in branches" or a tag in "Contained in tags".
 - Click on one of the listed branch or tag hyperlinks.
 
What is the expected behavior?
GitExtensions will select the revision for that branch or tag.
Environment you encounter the issue:
- GitExtensions version: master at 22709a7
 - GIT version: 2.16.2.windows.1
 - OS version: Windows 10
 
Did this work in previous version of GitExtensions (which)?
2.51 (and, from the code, 2.51.01)
Why it doesn't work
In 2.51.01 and earlier:
CommitDataManager.GetCommitData used String.IndexOf to find the position of the specified "revision" in the data returned from git log to verify that git log did indeed find the specified revision. However, for a branch or a tag the specified "revision" string will not exist in the output from git log. Instead it returns the sha1, which means that check should fail. However GetComitData checks the result of IndexOf incorrectly, passes that check, creates a CommitData and returns it.
Since the branch or tag was actually found, a good hyperlink is created and you can navigate to the branch or tag.
In master:
CommitDataManager.GetCommitData now calls TryGetCommitLog which still gets the same log data from git log with the same problem that the specified branch or tag name is not actually in the output from git log.
TryGetCommitLog now uses String.Contains in place of String.IndexOf and fails on the check, even though the output from git log is still viable to create a CommitData and return it.