Skip to content

Commit 69b97b5

Browse files
committed
fix(cli): preserve existing directories during single-file upload
Inspect remote destination types before choosing archive entry names. Keep directory and source symlinks intact, recheck detected type changes, and report the resulting path. Add real tar and live conformance coverage. Closes #4175 Signed-off-by: Shiju <shiju@nvidia.com>
1 parent 71c3cd9 commit 69b97b5

5 files changed

Lines changed: 591 additions & 62 deletions

File tree

‎crates/openshell-cli/src/main.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,11 @@ enum SandboxCommands {
17811781
#[arg(value_hint = ValueHint::AnyPath)]
17821782
local_path: String,
17831783

1784-
/// Destination path in the sandbox (defaults to the container's working directory).
1784+
/// Destination path in the sandbox (defaults to its working directory).
1785+
///
1786+
/// For an unfiltered single-file upload, an existing directory or a
1787+
/// trailing slash places the file inside that directory. A missing
1788+
/// nested path without a trailing slash renames the file.
17851789
dest: Option<String>,
17861790

17871791
/// Disable `.gitignore` filtering (uploads everything).

‎crates/openshell-cli/src/run.rs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4998,7 +4998,7 @@ pub async fn sandbox_upload(
49984998
dest_display
49994999
);
50005000

5001-
match upload_plan {
5001+
let uploaded_path = match upload_plan {
50025002
SandboxUploadPlan::GitAware { base_dir, files } => {
50035003
sandbox_sync_up_files(
50045004
server,
@@ -5011,13 +5011,18 @@ pub async fn sandbox_upload(
50115011
workspace,
50125012
)
50135013
.await?;
5014+
None
50145015
}
50155016
SandboxUploadPlan::Regular => {
5016-
sandbox_sync_up(server, name, local_path, sandbox_path, tls, workspace).await?;
5017+
Some(sandbox_sync_up(server, name, local_path, sandbox_path, tls, workspace).await?)
50175018
}
5018-
}
5019+
};
50195020

5020-
eprintln!("{} Upload complete", "✓".green().bold());
5021+
if let Some(path) = uploaded_path {
5022+
eprintln!("{} Upload complete: {path}", "✓".green().bold());
5023+
} else {
5024+
eprintln!("{} Upload complete", "✓".green().bold());
5025+
}
50215026
Ok(())
50225027
}
50235028

0 commit comments

Comments
 (0)