D5014: Add support for git worktrees

Thibault North noreply at phabricator.kde.org
Sat Mar 11 13:53:02 UTC 2017


tnorth created this revision.
Restricted Application added a subscriber: kdevelop-devel.

REVISION SUMMARY
  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.
  
  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.).

TEST PLAN
  - clone some git repository
  - checkout some branch in a new worktree
  - open the worktree location in Kdevelop
  - ensure that the branch is visible in the projects tab
  - ensure that the Git menu is available when right-clicking on an item in the document view
  - ensure that the annotation feature works

REPOSITORY
  R33 KDevPlatform

REVISION DETAIL
  https://phabricator.kde.org/D5014

AFFECTED FILES
  plugins/git/gitplugin.cpp

To: tnorth, #kdevelop
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170311/503a21e7/attachment.html>


More information about the KDevelop-devel mailing list