File tree Expand file tree Collapse file tree 5 files changed +39
-21
lines changed Expand file tree Collapse file tree 5 files changed +39
-21
lines changed Original file line number Diff line number Diff line change @@ -308,10 +308,8 @@ impl ThreadSafeRepository {
308
308
worktree_dir = gix_path:: realpath ( & wt_path) . ok ( ) ;
309
309
// restore the relative path if possible after resolving the absolute path
310
310
if wt_path. is_relative ( ) {
311
- if let Ok ( cwd) = std:: env:: current_dir ( ) {
312
- if let Some ( rel_path) = worktree_dir. as_deref ( ) . and_then ( |p| p. strip_prefix ( & cwd) . ok ( ) ) {
313
- worktree_dir = Some ( rel_path. to_path_buf ( ) ) ;
314
- }
311
+ if let Some ( rel_path) = worktree_dir. as_deref ( ) . and_then ( |p| p. strip_prefix ( & current_dir) . ok ( ) ) {
312
+ worktree_dir = Some ( rel_path. to_path_buf ( ) ) ;
315
313
}
316
314
}
317
315
Original file line number Diff line number Diff line change 8
8
/make_signatures_repo.tar
9
9
/make_diff_repos.tar
10
10
/make_submodule_with_worktree.tar
11
- /repo_with_untracked_files.tar
11
+ /repo_with_untracked_files.tar
12
+ /make_submodule_with_symlinked_git_dir.tar
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -eu -o pipefail
3
+
4
+ git init -q module1
5
+ (cd module1
6
+ touch this
7
+ mkdir subdir
8
+ touch subdir/that
9
+ git add .
10
+ git commit -q -m c1
11
+ echo hello >> this
12
+ git commit -q -am c2
13
+ touch untracked
14
+ )
15
+
16
+ mkdir symlinked-git-dir
17
+ (cd symlinked-git-dir
18
+ git init -q r1
19
+ (cd r1
20
+ git commit -q --allow-empty -m " init"
21
+ )
22
+
23
+ git config -f r1/.git/config core.worktree " $( pwd) "
24
+ ln -s r1/.git .git
25
+
26
+ git -c protocol.file.allow=always submodule add ../module1 m1
27
+ git commit -m " add module 1"
28
+ )
Original file line number Diff line number Diff line change @@ -151,18 +151,4 @@ git clone with-submodules not-a-submodule
151
151
git add m1 && git commit -m " no submodule in index and commit, but in configuration"
152
152
)
153
153
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
- )
154
+ git init unborn
Original file line number Diff line number Diff line change @@ -312,7 +312,12 @@ mod index_worktree {
312
312
313
313
#[ test]
314
314
fn submodule_in_symlinked_dir ( ) -> crate :: Result {
315
- let repo = submodule_repo ( "symlinked-git-dir" ) ?;
315
+ use crate :: util:: named_subrepo_opts;
316
+ let repo = named_subrepo_opts (
317
+ "make_submodule_with_symlinked_git_dir.sh" ,
318
+ "symlinked-git-dir" ,
319
+ gix:: open:: Options :: isolated ( ) ,
320
+ ) ?;
316
321
let status = repo
317
322
. status ( gix:: progress:: Discard ) ?
318
323
. index_worktree_options_mut ( |opts| {
You can’t perform that action at this time.
0 commit comments