File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -489,6 +489,21 @@ Vagrant.configure(2) do |config|
489
489
sudo chown #{ user } :#{ user } -R "#{ test_dir } /git2"
490
490
EOF
491
491
492
+ # A third Git repository
493
+ # Regression test for https://github.com/ogham/exa/issues/526
494
+ config . vm . provision :shell , privileged : false , inline : <<-EOF
495
+ set -xe
496
+ mkdir -p "#{ test_dir } /git3"
497
+ cd "#{ test_dir } /git3"
498
+ git init
499
+
500
+ # Create a symbolic link pointing to a non-existing file
501
+ ln -s aaa/aaa/a b
502
+
503
+ find "#{ test_dir } /git3" -exec touch {} -t #{ some_date } \\ ;
504
+ sudo chown #{ user } :#{ user } -R "#{ test_dir } /git3"
505
+ EOF
506
+
492
507
# Hidden and dot file testcases.
493
508
# We need to set the permissions of `.` and `..` because they actually
494
509
# get displayed in the output here, so this has to come last.
Original file line number Diff line number Diff line change @@ -266,11 +266,11 @@ impl Git {
266
266
fn reorient ( path : & Path ) -> PathBuf {
267
267
use std:: env:: current_dir;
268
268
// I’m not 100% on this func tbh
269
- match current_dir ( ) {
269
+ let path = match current_dir ( ) {
270
270
Err ( _) => Path :: new ( "." ) . join ( & path) ,
271
271
Ok ( dir) => dir. join ( & path) ,
272
- } . canonicalize ( ) . unwrap ( ) // errors can be ignored here because they only occur if
273
- // the path does not exist / a component is not a folder
272
+ } ;
273
+ path. canonicalize ( ) . unwrap_or ( path )
274
274
}
275
275
276
276
/// The character to display if the file has been modified, but not staged.
Original file line number Diff line number Diff line change @@ -210,6 +210,9 @@ $exa $testcases/git2/target -l --git 2>&1 | diff -q - $results
210
210
$exa $testcases /git2/deeply/nested/repository -l --git 2>&1 | diff -q - $results /git_2_repository || exit 1
211
211
$exa $testcases /git2/{deeply,ignoreds,target} -l --git 2>&1 | diff -q - $results /git_2_all || exit 1
212
212
213
+ # Regressions test
214
+ $exa $testcases /git3 -l --git & > /dev/null || echo " Failed to display broken symlink in git repository" ; exit 1
215
+
213
216
COLUMNS=150 $exa $testcases /git/** /* $testcases --git --long --grid -d | diff -q - $results /git_1_files || exit 1
214
217
215
218
$exa $testcases /git $testcases /git2 --git --long | diff -q - $results /git_12 || exit 1
You can’t perform that action at this time.
0 commit comments