Commit Graph

46 Commits

Author SHA1 Message Date
Benjamin Sago
3dc86c99ad New set of lints, and Rust 2018 idioms 2020-10-13 01:36:41 +01:00
Benjamin Sago
f8df02dae7 Batch source formatting
I read through every file and applied a couple of rustfmt suggestions. The brace placement and alignment of items on similar lines has been made consistent, even if neither are rustfmt's default style (a file has been put in place to enforce this). Other changes are:

• Alphabetical imports and modules
• Comma placement at the end of match blocks
• Use newlines and indentation judiciously
• Spaces around associated types
• Spaces after negations (it makes it more clear imho)
• Comment formatting
• Use early-returns and Optional `?` where appropriate
2020-10-10 20:02:55 +01:00
Benjamin Sago
c3c39fee0a Various misc clippy fixes 2020-10-10 15:57:40 +01:00
Benjamin Sago
a25cfe765d Remove some enum glob imports
These are holdovers from how I used to write Rust ("back in the day" of 2014). There are still some places in the code where I think it's worth glob-importing enums, but not these places.
2020-10-10 15:46:39 +01:00
Benjamin Sago
70a30ed683 The Selfening
This commit uses Clippy to fix all the 'use_self' warnings. Using Self instead of the type name has been good Rust style for a while now, and it's become the style I'm used to seeing.
2020-10-10 13:55:26 +01:00
Benjamin Sago
74d9f1402b Some Clippy fixes 2020-10-10 13:33:50 +01:00
Benjamin Sago
04e2d4c692 Just straight-up roll our own logger
This commit removes the env_logger dependency, replacing it with a simple implementation. Doing so removes like ten other transitive dependencies that no longer need to be included in the build.

It also gains the ability to enable trace-level logging. The users crate, which contains such logging statements as of the version I published a few days ago, has been upgraded to celebrate.

Also, change the log imports to globs. I'm only interested that a file doing logging, not what level it's logging at.
2020-10-10 02:01:12 +01:00
Benjamin Sago
cba2070924
Merge pull request #678 from olshevskiy87/display_git_status_conflicted
git-feature: display if a file is updated but unmerged (conflicted)
2020-10-08 22:10:33 +01:00
Benjamin Sago
d901bb289c
Merge pull request #654 from ariasuni/cleaning
Clean code a bit and fix typos in code documentation
2020-10-08 21:49:20 +01:00
Dmitriy Olshevskiy
45eade9a59 git-feature: display if a file is updated but unmerged (conflicted) 2020-05-29 17:23:22 +03:00
ariasuni
dba3f37b0a Fix Clippy lints 2020-05-24 21:43:55 +02:00
ariasuni
5a84953b4e Fix typos in code documentation 2020-04-19 06:54:06 +02:00
ariasuni
046af5cdd1 Use git2 instead of parsing .gitignore for --git-ignore
Fix #636
2020-04-19 05:52:35 +02:00
Benjamin Sago
64bd1b9a55
Merge pull request #584 from msehnout/fix-panic-on-broken-symlink
fix panic on broken symlink in git repository
2020-01-19 00:48:07 +00:00
Martin Sehnoutka
a7a8e99cf3 fix panic on broken symlink in git repository
The issue including reproducer is described here:
https://github.com/ogham/exa/issues/526
This commit includes proposed change as well as integration test.
2019-09-15 16:56:58 +02:00
Bond_009
8b60285320 Fix build without default features 2019-07-19 20:40:21 +02:00
Bond_009
f599c7ce93 Update to Rust 2018 2019-07-19 20:40:21 +02:00
Benjamin Sago
f1a5b646fe
Merge pull request #378 from LlinksRechts/master
fixed git status not working in directories containing '../'
2019-07-15 04:00:11 +01:00
Benjamin Sago
df9b32c892 Fix a couple warnings 2019-07-13 21:17:48 +01:00
ariasuni
80b0d9dd0d Display if a file is ignored by git 2018-11-20 18:12:38 +01:00
teresy
d63917af47 refactor: use shorthand fields 2018-11-06 17:43:01 -05:00
Thibaut Brandscheid
755876e9b6 fix most clippy warnings 2018-06-19 17:17:39 +02:00
Lukas Rysavy
2fc56d45ca fixed git status not working in directories containing '../' 2018-04-13 22:23:46 +02:00
Benjamin Sago
f757300718 Upgrade libgit2
The ogham/git2-rs repository that exa uses in the Vagrant VM has also been updated. The only casualty was that some constants got namespaced.
2018-03-11 11:25:06 +00:00
Benjamin Sago
937b325e3a Add some ignored tests for sub-globbing 2017-09-30 09:17:29 +02:00
Benjamin Sago
166d1f5e5a Glob pattern ignore tests 2017-09-30 09:17:29 +02:00
Benjamin Sago
541e6855f2 Test some actual ignore caches 2017-09-30 09:17:29 +02:00
Benjamin Sago
476299e21f A note to my future self
It’s important to capture the current behaviour, even if it ends up being totally wrong.
2017-09-30 09:17:29 +02:00
Benjamin Sago
108dc80944 Ignore comments and blank lines when ignoring 2017-09-30 09:17:29 +02:00
Benjamin Sago
7b5b02d9f1 Extract function for parsing an ignore file 2017-09-30 09:17:29 +02:00
Benjamin Sago
1f23f3f0cc Don’t ignore .gitignore errors 2017-09-30 09:17:29 +02:00
Benjamin Sago
827aa8bfc3 Ignore files matched in .gitignore
This doesn’t *completely* work: it seems to have trouble with ignored paths beginning with slashes, possibly amongst others. Also, .gitignore scanning could be made more efficient.
2017-09-30 09:17:29 +02:00
Benjamin Sago
b95446d834 Thread an ignore cache through the program
!
2017-09-30 09:17:29 +02:00
Benjamin Sago
4819c4721b Fix compile error with --no-default-features
Fixes #283. Also, have Travis compile without default features either, so I get warned the next time I break it.
2017-09-14 11:33:24 +01:00
Benjamin Sago
c60ea36a31 Allow --git --tree, too
This works by checking if any of the (immediate) files being listed are under Git, and hiding the column if all aren’t.
2017-09-02 12:53:08 +01:00
Benjamin Sago
9cda05df20 Only display Git column for directories with repos
This fixes the previous commit.
2017-09-02 00:04:22 +01:00
Benjamin Sago
45a807a14f Redo Git implementation to allow --git --recurse
This is all a big commit because it took a lot more work than I thought it would! The commit basically moves Git repositories from being per-directory to living for the whole life of the program. This allows for several directories in the same repository to be listed in the same invocation; before, it would try to rediscover the repository each time! This is why two of the tests “broke”: it suddenly started working with --recurse.

The Dir type does now not use Git at all; because a Dir doesn’t have a Git, then a File doesn’t have one either, so the Git cache gets passed to the render functions which will put them in the Table to render them.
2017-09-01 19:13:47 +01:00
Benjamin Sago
3d4ddf8af6 Group Git repositories by their workdir
This uses the Git module’s newfound powers of getting actual GitRepo values from a factory to cache repositories a bit more. Now, when querying two directories under the same repository, it’ll open both, see that they have the same workdir, and only use the first one.
2017-08-28 23:52:21 +01:00
Benjamin Sago
62075fe984 Code and logging fix-ups 2017-08-28 18:40:52 +01:00
Benjamin Sago
040dbb2414 Use a global Git cache
This commit adds a cache for Git repositories based on the path being queried.

Its only immediate effect is that when you query the same directory twice (such as /testcases/git /testcases/git), it won’t need to check that the second one is a Git directory the second time. So, a minuscule optimisation for something you’d never do anyway? Wrong! It’s going to let us combine multiple entries over the same repository later, letting us use --tree and --recurse, because now Git scanning is behind a factory.
2017-08-28 18:11:38 +01:00
Benjamin Sago
d86fc4286b \t and \s+$ 2017-08-26 23:54:12 +01:00
Benjamin Sago
377260d88c Start logging at opportune moments
I want to be very careful when doing the “--git and --tree don’t work together” one to not search for more Git repositories than I should. Being able to log when a repository is looked up and also switch that functionality on and off would help with that.
2017-08-19 10:06:43 +01:00
Daniel Lockyer
b68627ce1a Switch to padding reference as variable not consumed 2017-03-31 17:09:50 +01:00
Benjamin Sago
3bce55f569 Run Untry over the entire source tree 2017-03-26 17:35:50 +01:00
Hendrik Sollich
c2d42e7d84 Fix building without default features 2016-05-03 00:03:22 +02:00
Benjamin Sago
efa372cb3b Source file rearrangements
This commit moves file, dir, and the feature modules into one parent 'fs' module. Now there are three main 'areas' of the code: main and options, the filesystem-touching code, and the output-displaying code.

It should be the case that nothing in 'output' touches 'std::fs'.
2016-04-16 18:59:25 +01:00