1. 29 6月, 2017 5 次提交
    • B
      Add sorting by type · f7505364
      Benjamin Sago 提交于
      This isn’t perfect, as a file’s type isn’t cached, so it gets recomputed for every comparison in the sort! We can’t go off the file’s `st_mode` flag because it’s not guaranteed to be in any order between systems.
      f7505364
    • B
      Add a test for inode sorting · 7d1448da
      Benjamin Sago 提交于
      7d1448da
    • B
      Add sort tests for name and ext and lowercase · 098788c9
      Benjamin Sago 提交于
      098788c9
    • B
      Upcase some of the extension testcases · 9d740911
      Benjamin Sago 提交于
      These are going to be used for sort testing. Unfortunately, three existing tests that were using the lowercase versions had to be changed.
      9d740911
    • B
      Override the names of . and .. · dd8bff08
      Benjamin Sago 提交于
      There was a problem when displaying . and .. in directory listings: their names would normalise to actual names! So instead of literally seeing `.`, you’d see the current directory’s name, inserted in sort order into the list of results. Obviously this is not what we want.
      
      In unrelated news, putting `.` and `..` into the list of paths read from a directory just takes up more heap space for something that’s basically constant.
      
      We can solve both these problems at once by moving the DotFilter to the files iterator in Dir, rather than at the Dir’s creation. Having the iterator know whether it should display `.` and `..` means it can emit those files first, and because it knows what those files really represent, it can override their file names to actually be those sequences of dots.
      
      This is not a perfect solution: the main casualty is that a File can now be constructed with a name, some metadata, both, or neither. This is currently handled with a bunch of Options, and returns IOResult even without doing any IO operations.
      
      But at least all the tests pass!
      dd8bff08
  2. 25 6月, 2017 2 次提交
    • B
      Fix bug where colours were incorrectly applied · 84b01f20
      Benjamin Sago 提交于
      exa assumed that the COLUMNS environment variable being present always meant that the output was to a terminal, so it should use colours. But because this variable can be overridden, colours were being incorrectly set!
      
      The ‘fix’ is to stop trying to be clever while only calculating the terminal width once, and instead just stick it in a lazy_static so it’s usable everywhere.
      84b01f20
    • B
      Tests for disabling colours · 4e90b4d7
      Benjamin Sago 提交于
      4e90b4d7
  3. 24 6月, 2017 3 次提交
  4. 19 5月, 2017 1 次提交
    • B
      Don’t core dump when given invalid UTF-8 arguments · de60b958
      Benjamin Sago 提交于
      By parsing OsStrings rather than Strings, it’s the getopts crate that’s doing the UTF-8 checking rather than us, so if one of them isn’t valid, it’ll just fail to parse rather than crash exa.
      
      Also, save a few allocations here and there.
      de60b958
  5. 18 5月, 2017 1 次提交
  6. 17 5月, 2017 1 次提交
  7. 16 5月, 2017 1 次提交
    • B
      Re-prefix the paths found by following symlinks · 108a402d
      Benjamin Sago 提交于
      Fixes #134, a bug that showed symlinks incorrectly as broken, but only when the file was listed directly on the command-line *and* the file was in a different directory to the one exa was being run in.
      
      I’m not sure why the old code used `String::new()`, but it doesn’t seem to affect anything.
      108a402d
  8. 03 5月, 2017 1 次提交
    • B
      Fix bug where paths took up twice as much space · ba1c8c65
      Benjamin Sago 提交于
      For some reason, the code that calculated the width of a cell with a path in counted the width of the path twice: once from the ANSIStrings containing it, and once more added on afterwards. This meant that the grid view thought that columns were wider than they really were, meaning fewer could be fit into a grid.
      ba1c8c65
  9. 02 5月, 2017 1 次提交
    • B
      Also escape characters in links and headings · 56d4d4c1
      Benjamin Sago 提交于
      Doing this meant that the escaping functionality got used in three places, so it was extracted into a generalised function in its own module.
      
      This is slighly slower for the case where escaped characters are displayed in the same colour as the displayable characters, which happens when listing a directory’s name when recursing. Optimise this, yeah?
      56d4d4c1
  10. 01 5月, 2017 1 次提交
    • B
      Only highlight escaped characters in file names · eb7e53ef
      Benjamin Sago 提交于
      Rather than the *entire* file name.
      
      The current method is extremely inefficient, but having control characters in file names is also extremely uncommon; it’s something that should be fixed, only eventually.
      eb7e53ef
  11. 29 4月, 2017 7 次提交
    • B
      Further tests for printing out directory names · 0c69eeca
      Benjamin Sago 提交于
      ., .., and / always seem to cause problems.
      0c69eeca
    • B
      oops · f8b82642
      Benjamin Sago 提交于
      I think I took this off to see how the output was different. Which means there should really be a better way to check how the output is different, other than running the command and looking!
      f8b82642
    • B
      Tests for the directory path fix · 3d97dffc
      Benjamin Sago 提交于
      3d97dffc
    • B
      Tests for classify and special file types · 456fa287
      Benjamin Sago 提交于
      456fa287
    • B
      Rename file-types tests to file-names-exts · bd5095d0
      Benjamin Sago 提交于
      This name more accurately reflects which code is being tested (things like .png and Makefile, rather than pipes and sockets), freeing up file-types for *actual* file types to be tested.
      bd5095d0
    • B
      Protect xtests against different default users · ef18f9ca
      Benjamin Sago 提交于
      The Vagrant tests assumed that there’d be a user called “vagrant” that would run the tests and create the files by default. Files would be owned by vagrant:vagrant by default, and this worked, until it came time to change that username. The naïve method was a search-and-replace, but this caused problems when the new user’s name wasn’t exactly the same length as the previous one.
      
      So to fix this, we now have our own user, named after the first animal I thought of, that makes the files’ owners and groups independent of the default user of whichever VM image the xtests are running on.
      
      Another place where it was hard-coded was the home directory, which was “/home/vagrant”, where the awkward testcases live. That last one has been changed to just “/testcases”, which has no mention of the user in it.
      ef18f9ca
    • B
      Protect xtests against the passage of time · b885b34a
      Benjamin Sago 提交于
      There was a problem with the Vagrant tests where the year 2016 was hard-coded in as the modified date. This had to be done to make the --long tests use the correct date format, which varies depending on whether the timestamp is in the current year.
      
      Unfortunately, time progresses [citation needed], and what was once 2016 is now 2017, so the date format changed and the tests broke.
      
      Because the Vagrantfile is just a Ruby script, we can look up the current year at runtime and use that instead. There’s also a check added to the test runner that makes sure none of the files are more than 365 days old, because if any are, then it’s time to update the timestamps (or it’s the last day of a leap year)
      b885b34a
  12. 30 10月, 2016 6 次提交
    • B
      Basic glob ignoring · 95596297
      Ben S 提交于
      See #97 and recently #130 too.
      
      This allows the user to pass in options such as "--ignore '*.pyc'" to not list any files ending in '.pyc' in the output. It uses the Rust glob crate and currently does a simple split on pipe, without any escaping, so it’s not really *complete*, but is at least something.
      95596297
    • B
      Fix integration test by making it time-independent · bd2a76b4
      Ben S 提交于
      bd2a76b4
    • B
      Properly handle errors when following a symlink · 74358c18
      Ben S 提交于
      Fixes #123. The code assumes that every File that has its link_target() method called would first have been checked to make sure it’s actually a link first. Unfortunately it also assumed that the only thing that can go wrong while following a link is if the file wasn’t a link, meaning it crashes when given a link it doesn’t have permission to follow.
      
      This makes the file_target() method able to return either a file or path for displaying, as before, but also an IO error for when things go wrong.
      74358c18
    • B
      Add some symlink testcases · ba366fc8
      Ben S 提交于
      ba366fc8
    • B
      Write some file-type integration tests · 9589496a
      Ben S 提交于
      9589496a
    • B
      Only engage the view when there are files to show · a7e3456b
      Ben S 提交于
      This changes the way that views are used to display the actual lists of files. It used to pass empty vectors to the view methods, which most of the time would not print anything because there are no files to list — except when there’s a header row which gets printed for no files.
      
      By not calling the view method at all when there’s nothing to print, exa won’t ever print extra things in the view unless it needs to for a file.
      
      This fixes #106 “Don’t print the header if the result set is empty”
      a7e3456b
  13. 08 10月, 2016 1 次提交
    • B
      Replace the testcases script with a Vagrant VM · 54067bf7
      Benjamin Sago 提交于
      See the README section for more details. Basically, with this way, we can store a bunch of existing valid exa outputs, change a VM's environment to match our values, then check that exa still works by comparing outputs.
      54067bf7