`sandbox upload` creates a directory instead of a file when source is inside a git repository
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 8.7k
- Forks
- 1.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 253
Description
What happens
`openshell sandbox upload` creates a directory at the destination path instead of a regular file when the source file lives inside a git repository and the destination basename differs from the source basename. The directory contains the uploaded file under the original source basename.
What should happen
The file should land at the exact destination path with the destination basename, matching cp-style semantics — regardless of whether the source is inside a git repository.
How to reproduce
# Create and detach a sandbox
openshell sandbox create --name my-sandbox -- sleep 300 &
sleep 5
SANDBOX="my-sandbox"
openshell sandbox exec -n "${SANDBOX}" -- mkdir -p /tmp/repro/git-case /tmp/repro/nogit-case
# Case 1 (BUG): source inside a git repository
GITDIR="$(mktemp -d)"
echo '{"hello":"world"}' > "${GITDIR}/source.json"
git -C "${GITDIR}" init -q
git -C "${GITDIR}" add source.json
git -C "${GITDIR}" -c user.email="x@x" -c user.name="x" commit -q -m "init"
openshell sandbox upload "${SANDBOX}" "${GITDIR}/source.json" /tmp/repro/git-case/dest.json
openshell sandbox exec -n "${SANDBOX}" -- ls -la /tmp/repro/git-case/
# dest.json is a directory (BUG)
# Case 2 (OK): source outside any git repository
NOGITDIR="$(mktemp -d)"
echo '{"hello":"world"}' > "${NOGITDIR}/source.json"
openshell sandbox upload "${SANDBOX}" "${NOGITDIR}/source.json" /tmp/repro/nogit-case/dest.json
openshell sandbox exec -n "${SANDBOX}" -- ls -la /tmp/repro/nogit-case/
# dest.json is a regular file (correct)
Case 1 — source in git repo (bug):
drwxr-xr-x. 1 sandbox sandbox 22 Jun 4 dest.json
Case 2 — source outside git repo (correct):
-rw-r--r--. 1 sandbox sandbox 18 Jun 4 dest.json
Context
The cp-style fix from #694 corrected this for the non-git upload path. When the source is inside a git repository, the upload routes through git_sync_files, which still uses the old mkdir -p <dest> behavior. PR #1595 bypassed git_sync_files for symlinks but not for regular tracked files.
- openshell version: 0.0.54
- OS: Linux x86_64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the git_sync_files upload path and compare its destination handling with the cp-style behavior fixed in #694; PR #1595 provides related context for symlinks. Reproduce the tracked-file case from the issue, then add coverage showing that a source inside a Git repository arrives as a regular file at the exact destination basename.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100