This patch adds support for the git worktree feature (see https://git-scm.com/docs/git-worktree ).
In a worktree, there is no .git/ folder, rather a .git file which contains a path to the corresponding worktree within the .git folder of the repository.
Also see the bug report here: https://bugs.kde.org/show_bug.cgi?id=375849
The only change required in kdevplatform is a modification of the isValidDirectory() function, which currently checks that a file called HEAD actually exists in the .git/ directory. In the case of a worktree, .git is a file instead, on the function returns false.
With this modification, isValidDirectory now also checks if .git is a file. If it is, the content is retrieved. If the file content matches the typical format of a worktree .git file, the directory is said to be valid.
Sources that lie in a git worktree are now detected as being in a git directory, and the git integration is functional (git, commit, annotate, etc.).