Unverified Commit 3addb796 by Edward Thomson Committed by GitHub

Merge pull request #5943 from kcsaul/fix/5851

Fix worktree iteration when repository has no common directory
parents 4e8840fd e71505b3
......@@ -2335,6 +2335,12 @@ int git_repository_foreach_worktree(git_repository *repo,
int error;
size_t i;
/* apply operation to repository supplied when commondir is empty, implying there's
* no linked worktrees to iterate, which can occur when using custom odb/refdb
*/
if (!repo->commondir)
return cb(repo, payload);
if ((error = git_repository_open(&worktree_repo, repo->commondir)) < 0 ||
(error = cb(worktree_repo, payload) != 0))
goto out;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment