You've already forked uutils.github.io
mirror of
https://github.com/uutils/uutils.github.io.git
synced 2026-06-10 16:12:28 -07:00
deploy: f0e8d44e6e
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -475,7 +475,7 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes humantime
|
||||
// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes
|
||||
|
||||
</span><span class="kw">use </span>chrono::format::{Item, StrftimeItems};
|
||||
<span class="kw">use </span>chrono::{DateTime, Duration, FixedOffset, Local, Offset, Utc};
|
||||
@@ -639,7 +639,7 @@
|
||||
};
|
||||
|
||||
<span class="kw">let </span>date_source = <span class="kw">if let </span><span class="prelude-val">Some</span>(date) = matches.get_one::<String>(OPT_DATE) {
|
||||
<span class="kw">if let </span><span class="prelude-val">Ok</span>(duration) = humantime_to_duration::from_str(date.as_str()) {
|
||||
<span class="kw">if let </span><span class="prelude-val">Ok</span>(duration) = parse_datetime::from_str(date.as_str()) {
|
||||
DateSource::Human(duration)
|
||||
} <span class="kw">else </span>{
|
||||
DateSource::Custom(date.into())
|
||||
|
||||
@@ -644,7 +644,7 @@
|
||||
<span class="kw">use </span>uucore::backup_control::{<span class="self">self</span>, BackupMode};
|
||||
<span class="kw">use </span>uucore::display::Quotable;
|
||||
<span class="kw">use </span>uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError, UUsageError};
|
||||
<span class="kw">use </span>uucore::fs::are_hardlinks_to_same_file;
|
||||
<span class="kw">use </span>uucore::fs::are_hardlinks_or_one_way_symlink_to_same_file;
|
||||
<span class="kw">use </span>uucore::update_control::{<span class="self">self</span>, UpdateMode};
|
||||
<span class="kw">use </span>uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show};
|
||||
|
||||
@@ -874,7 +874,7 @@
|
||||
<span class="kw">return </span><span class="prelude-val">Err</span>(MvError::NoSuchFile(source.quote().to_string()).into());
|
||||
}
|
||||
|
||||
<span class="kw">if </span>(source.eq(target) || are_hardlinks_to_same_file(source, target))
|
||||
<span class="kw">if </span>(source.eq(target) || are_hardlinks_or_one_way_symlink_to_same_file(source, target))
|
||||
&& b.backup != BackupMode::SimpleBackup
|
||||
{
|
||||
<span class="kw">if </span>source.eq(Path::new(<span class="string">"."</span>)) || source.ends_with(<span class="string">"/."</span>) || source.is_file() {
|
||||
|
||||
@@ -843,6 +843,36 @@
|
||||
<a href="#843" id="843">843</a>
|
||||
<a href="#844" id="844">844</a>
|
||||
<a href="#845" id="845">845</a>
|
||||
<a href="#846" id="846">846</a>
|
||||
<a href="#847" id="847">847</a>
|
||||
<a href="#848" id="848">848</a>
|
||||
<a href="#849" id="849">849</a>
|
||||
<a href="#850" id="850">850</a>
|
||||
<a href="#851" id="851">851</a>
|
||||
<a href="#852" id="852">852</a>
|
||||
<a href="#853" id="853">853</a>
|
||||
<a href="#854" id="854">854</a>
|
||||
<a href="#855" id="855">855</a>
|
||||
<a href="#856" id="856">856</a>
|
||||
<a href="#857" id="857">857</a>
|
||||
<a href="#858" id="858">858</a>
|
||||
<a href="#859" id="859">859</a>
|
||||
<a href="#860" id="860">860</a>
|
||||
<a href="#861" id="861">861</a>
|
||||
<a href="#862" id="862">862</a>
|
||||
<a href="#863" id="863">863</a>
|
||||
<a href="#864" id="864">864</a>
|
||||
<a href="#865" id="865">865</a>
|
||||
<a href="#866" id="866">866</a>
|
||||
<a href="#867" id="867">867</a>
|
||||
<a href="#868" id="868">868</a>
|
||||
<a href="#869" id="869">869</a>
|
||||
<a href="#870" id="870">870</a>
|
||||
<a href="#871" id="871">871</a>
|
||||
<a href="#872" id="872">872</a>
|
||||
<a href="#873" id="873">873</a>
|
||||
<a href="#874" id="874">874</a>
|
||||
<a href="#875" id="875">875</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
|
||||
//
|
||||
// (c) Joseph Crail <jbcrail@gmail.com>
|
||||
@@ -1493,6 +1523,36 @@
|
||||
source_metadata.ino() == target_metadata.ino() && source_metadata.dev() == target_metadata.dev()
|
||||
}
|
||||
|
||||
<span class="attr">#[cfg(not(unix))]
|
||||
</span><span class="kw">pub fn </span>are_hardlinks_or_one_way_symlink_to_same_file(_source: <span class="kw-2">&</span>Path, _target: <span class="kw-2">&</span>Path) -> bool {
|
||||
<span class="bool-val">false
|
||||
</span>}
|
||||
|
||||
<span class="doccomment">/// Checks if either two paths are hard links to the same file or if the source path is a symbolic link which when fully resolved points to target path
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `source` - A reference to a `Path` representing the source path.
|
||||
/// * `target` - A reference to a `Path` representing the target path.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `bool` - Returns `true` if either of above conditions are true, and `false` otherwise.
|
||||
</span><span class="attr">#[cfg(unix)]
|
||||
</span><span class="kw">pub fn </span>are_hardlinks_or_one_way_symlink_to_same_file(source: <span class="kw-2">&</span>Path, target: <span class="kw-2">&</span>Path) -> bool {
|
||||
<span class="kw">let </span>source_metadata = <span class="kw">match </span>fs::metadata(source) {
|
||||
<span class="prelude-val">Ok</span>(metadata) => metadata,
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="kw">return </span><span class="bool-val">false</span>,
|
||||
};
|
||||
|
||||
<span class="kw">let </span>target_metadata = <span class="kw">match </span>fs::symlink_metadata(target) {
|
||||
<span class="prelude-val">Ok</span>(metadata) => metadata,
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="kw">return </span><span class="bool-val">false</span>,
|
||||
};
|
||||
|
||||
source_metadata.ino() == target_metadata.ino() && source_metadata.dev() == target_metadata.dev()
|
||||
}
|
||||
|
||||
<span class="attr">#[cfg(test)]
|
||||
</span><span class="kw">mod </span>tests {
|
||||
<span class="comment">// Note this useful idiom: importing names from outer (for mod tests) scope.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../uucore/fs/fn.are_hardlinks_or_one_way_symlink_to_same_file.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../uucore/fs/fn.are_hardlinks_or_one_way_symlink_to_same_file.html">../../../uucore/fs/fn.are_hardlinks_or_one_way_symlink_to_same_file.html</a>...</p>
|
||||
<script>location.replace("../../../uucore/fs/fn.are_hardlinks_or_one_way_symlink_to_same_file.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
window.SIDEBAR_ITEMS = {"enum":["MissingHandling","ResolveMode"],"fn":["are_hardlinks_to_same_file","canonicalize","dir_strip_dot_for_creation","display_permissions","display_permissions_unix","infos_refer_to_same_file","is_symlink_loop","make_path_relative_to","normalize_path","paths_refer_to_same_file","resolve_relative_path"],"macro":["has"],"struct":["FileInformation"]};
|
||||
window.SIDEBAR_ITEMS = {"enum":["MissingHandling","ResolveMode"],"fn":["are_hardlinks_or_one_way_symlink_to_same_file","are_hardlinks_to_same_file","canonicalize","dir_strip_dot_for_creation","display_permissions","display_permissions_unix","infos_refer_to_same_file","is_symlink_loop","make_path_relative_to","normalize_path","paths_refer_to_same_file","resolve_relative_path"],"macro":["has"],"struct":["FileInformation"]};
|
||||
Reference in New Issue
Block a user