diff options
author | Janne Valkealahti <janne.valkealahti@broadcom.com> | 2024-07-04 07:44:49 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-07-14 23:39:07 +0200 |
commit | f9beeb3b33e438fa3a10eb3871206573ae986abb (patch) | |
tree | 05d5d457e28eaba705c8a9041968247740c3cc18 /org.eclipse.jgit/src/org/eclipse/jgit/treewalk | |
parent | 2a19bfc7319a55ba00dbdaf469481f0ddee8b4f5 (diff) | |
download | jgit-f9beeb3b33e438fa3a10eb3871206573ae986abb.tar.gz jgit-f9beeb3b33e438fa3a10eb3871206573ae986abb.zip |
Add worktrees read support
Based on deritative work done in Andre's work in [1].
This change focuses on adding support for reading the repository
state when branches are checked out using git's worktrees.
I've refactored original work by removing all unrelevant
changes which were mostly around refactoring to extract
i.e. constants which mostly created noise for a review.
I've tried to address original review comments:
- Not adding non-behavioral changes
- "HEAD" should get resolved from gitDir
- Reftable recently landed in cgit 2.45,
see https://github.com/git/git/blob/master/Documentation/RelNotes/2.45.0.txt#L8
We can add worktree support for reftable in a later change.
- Some new tests to read from a linked worktree which
is created manually as there's no write support.
[1] https://git.eclipse.org/r/c/jgit/jgit/+/163940/18
Change-Id: Id077d58fb6c09ecb090eb09d5dbc7edc351a581d
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/treewalk')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 73a3ddaae7..95e9964192 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -498,6 +498,8 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { filterProcessBuilder.directory(repository.getWorkTree()); filterProcessBuilder.environment().put(Constants.GIT_DIR_KEY, repository.getDirectory().getAbsolutePath()); + filterProcessBuilder.environment().put(Constants.GIT_COMMON_DIR_KEY, + repository.getCommonDirectory().getAbsolutePath()); ExecutionResult result; try { result = fs.execute(filterProcessBuilder, in); @@ -1332,7 +1334,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { IgnoreNode infoExclude = new IgnoreNodeWithParent( coreExclude); - File exclude = fs.resolve(repository.getDirectory(), + File exclude = fs.resolve(repository.getCommonDirectory(), Constants.INFO_EXCLUDE); if (fs.exists(exclude)) { loadRulesFromFile(infoExclude, exclude); |