Thanks to visit codestin.com Credit goes to libgit2.org
Check if worktree is valid
A valid worktree requires both the git data structures inside the linked parent repository and the linked working copy to be present.
Worktree to check
0 when worktree is valid, error-code otherwise