Skip to content

Commit 2946c2b

Browse files
add test for symlinked git dir with submodules
1 parent 442f800 commit 2946c2b

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed
142 KB
Binary file not shown.

gix/tests/fixtures/make_submodules.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,18 @@ git clone with-submodules not-a-submodule
151151
git add m1 && git commit -m "no submodule in index and commit, but in configuration"
152152
)
153153

154-
git init unborn
154+
git init unborn
155+
156+
mkdir symlinked-git-dir
157+
(cd symlinked-git-dir
158+
git init -q r1
159+
(cd r1
160+
git commit -q --allow-empty -m "init"
161+
)
162+
163+
git config -f r1/.git/config core.worktree `pwd`
164+
ln -s r1/.git .git
165+
166+
git -c protocol.file.allow=always submodule add ../module1 m1
167+
git commit -m "add module 1"
168+
)

gix/tests/gix/status.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,20 @@ mod index_worktree {
310310
);
311311
}
312312

313+
#[test]
314+
fn submodule_in_symlinked_dir() -> crate::Result {
315+
let repo = submodule_repo("symlinked-git-dir")?;
316+
let mut status = repo
317+
.status(gix::progress::Discard)?
318+
.index_worktree_options_mut(|opts| {
319+
opts.sorting =
320+
Some(gix::status::plumbing::index_as_worktree_with_renames::Sorting::ByPathCaseSensitive);
321+
})
322+
.into_index_worktree_iter(None)?;
323+
assert!(status.all(|r| r.is_ok()), "status should not have any errors");
324+
Ok(())
325+
}
326+
313327
#[test]
314328
fn submodule_modification() -> crate::Result {
315329
let repo = submodule_repo("modified-untracked-and-submodule-head-changed-and-modified")?;

0 commit comments

Comments
 (0)