Skip to content

Commit 654cc4b

Browse files
committed
Merge pull request #87 from rage/fix-migrate-lock
skip moving lock file
1 parent 466156b commit 654cc4b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tmc-langs-cli/src/main.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ use config::ConfigValue;
1919
use heim::disk;
2020
use serde::Serialize;
2121
use serde_json::Value as JsonValue;
22-
use std::collections::{BTreeMap, HashMap};
2322
use std::env;
2423
use std::error::Error as StdError;
2524
use std::fs::{self, File};
2625
use std::io::Write;
2726
use std::path::{Path, PathBuf};
27+
use std::{
28+
collections::{BTreeMap, HashMap},
29+
ffi::OsStr,
30+
};
2831
use tempfile::NamedTempFile;
2932
use tmc_client::oauth2::{
3033
basic::BasicTokenType, AccessToken, EmptyExtraTokenFields, Scope, StandardTokenResponse,
@@ -1886,6 +1889,22 @@ fn move_dir(source: &Path, target: &Path, pretty: bool) -> anyhow::Result<()> {
18861889
entry.with_context(|| format!("Failed to read file inside {}", source.display()))?;
18871890
let entry_path = entry.path();
18881891

1892+
if entry_path.file_name() == Some(OsStr::new(".tmc.lock")) {
1893+
log::info!("skipping lock file");
1894+
file_count_copied += 1;
1895+
reporter
1896+
.progress(
1897+
format!(
1898+
"Skipped moving file {} / {}",
1899+
file_count_copied, file_count_total
1900+
),
1901+
file_count_copied as f64 / file_count_total as f64,
1902+
None,
1903+
)
1904+
.map_err(|e| anyhow::anyhow!(e))?;
1905+
continue;
1906+
}
1907+
18891908
if entry_path.is_file() {
18901909
let relative = entry_path.strip_prefix(source).unwrap();
18911910
let target_path = target.join(relative);

0 commit comments

Comments
 (0)