Commit Graph

33 Commits

Author SHA1 Message Date
Mélanie Chauvel fe11b9d319 Fix panic on non UTF-8 file when using Git 2021-09-01 22:42:34 +02:00
ariasuni bd4f144884 Fix deducing git ignored state for files too, not only directories 2021-04-10 00:56:07 +02:00
ariasuni 8c10feec51 Fix --git deducing ignored state in unintuitive way
It makes sense to consider that a directory has the aggregated status of all the files under it.

The exception is that for the ignored status, it’s more useful and intuitive to consider that it applies to everything under it.

- A directory containing an ignored file is no longer considered ignored
- A file inside an ignored directory is now considered ignored
2021-04-09 21:47:42 +02:00
Benjamin Sago 4a108c1786 Fix a new compile-time warning 2021-04-01 09:39:12 +01:00
Benjamin Sago 002080cde8 Clippy pedantic lints
This commit fixes a couple of Clippy warnings, and adds the list of lints we're OK with.

It does raise some important warnings, such as those to do with casting, which aren't allowed so they can be fixed later.
2020-10-13 01:46:17 +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 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
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
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 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
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 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
Benjamin Sago 3bce55f569 Run Untry over the entire source tree 2017-03-26 17:35:50 +01: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