Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: introduce a new btime term to align ctime with Unix #1761

Merged
merged 2 commits into from
Oct 11, 2024
Merged

Conversation

sxyazi
Copy link
Owner

@sxyazi sxyazi commented Oct 11, 2024

Fixes #1760

This is a tricky issue. The initial introduction of ctime was just to correspond with the "created time" in Rust:

ctime: m.created().ok(),

which isn't a problem on non-Unix platforms.

However, in Unix, ctime has a different meaning — it refers to "changed time" which indicates when file attributes changed, yet it's distinct from mtime ("modified time") which indicates when file content is modified.

This PR attempts to address the issue fundamentally by aligning with Unix. This way, Yazi behaves correctly on Unix platforms, while also being fine on non-Unix platforms since they don't have the concept of ctime at all, and then we'll always use btime to represent a file's "created time", i.e. "birth time".

⚠️ Breaking changes

Renamed created to btime, modified to mtime for the sort_by option

# yazi.toml
[manager]
- sort_by = "created"
+ sort_by = "btime"

- sort_by = "modified"
+ sort_by = "mtime"

Renamed ctime to btime for the linemode command

# keymap.toml
- { on = [ "m", "c" ], run = "linemode ctime"  }
+ { on = [ "m", "b" ], run = "linemode btime" }

Renamed created to btime, modified to mtime for the sort command

# keymap.toml
- { on = [ ",", "c" ], run = "sort created" }
+ { on = [ ",", "b" ], run = "sort btime" },
# keymap.toml
- { on = [ ",", "m" ], run = "sort modified" }
+ { on = [ ",", "m" ], run = "sort mtime" }

Renamed the created, modified, accessed, length, and permissions properties of the Cha

  • created => btime
  • modified => mtime
  • accessed => atime
  • length => len
  • permissions => perm

Note that the old names are still available, but a deprecation warning will shown — they will be completely removed in the next major version 0.4.2.

@sxyazi sxyazi merged commit 2014aee into main Oct 11, 2024
6 checks passed
@sxyazi sxyazi deleted the pr-85c8bb40 branch October 11, 2024 10:05
GrzegorzKozub added a commit to GrzegorzKozub/yazi that referenced this pull request Oct 13, 2024
dedukun added a commit to dedukun/hexyl.yazi that referenced this pull request Oct 16, 2024
Reledia added a commit to Reledia/hexyl.yazi that referenced this pull request Oct 16, 2024
mikavilpas added a commit to mikavilpas/dotfiles that referenced this pull request Oct 24, 2024
@sxyazi sxyazi mentioned this pull request Nov 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yazi uses term 'ctime' incorrectly
1 participant