Commit e60220d
committed
make it work with remote repos
1. lfs/config.rs — Added resolve_remote()
- New async method that parses remote_url → RemoteRepository via
api::client::repositories::get_by_url()
- Returns Ok(None) when no remote is configured, errors if URL is set but repo doesn't
exist
2. api/client/versions.rs — Generic download_versions_to_store()
- Extracted the HTTP QUERY + gzip + tar extraction logic into
try_download_versions_to_store() that takes &dyn VersionStore
- Added public download_versions_to_store() with retry wrapper (same retry logic as
original)
- Refactored try_download_data_from_version_paths to delegate — zero behavior change
for existing callers
3. lfs/sync.rs — git_add() error handling
- Changed return type from () to Result<(), OxenError>
- Propagates spawn errors, logs non-zero exit as warning (non-fatal)
- Updated both call sites to use ?
4. lfs/sync.rs — Real push_to_remote() implementation
- Loads LfsConfig, resolves remote — skips if no remote configured
- Builds a temp staging dir with files hard-linked/copied from version store at their
real repo-relative paths
- Creates workspace → add_files → commit via workspace API
- On error, attempts workspace cleanup via delete
- Renamed _args → hook_args and logs for debugging
5. lfs/sync.rs — Real pull_from_remote() with remote download
- After local + origin resolution, collects still-missing OIDs into need_remote
- If !local_only and remote is configured, batch-downloads via
download_versions_to_store()
- Restores downloaded files to working tree and runs git_add()
6. lfs/sync.rs — fetch_all() updated for remote
- After local+origin resolution, tries configured Oxen remote for unresolved pointers
- Only errors if pointers remain unresolved AND no remote is available
7. lfs/filter.rs — Remote fetch in smudge() with 30s timeout
- Renamed _lfs_config → lfs_config
- After local + origin checks, attempts remote fetch wrapped in
tokio::time::timeout(30s)
- On success, reads from local store; on timeout/error, falls through to pointer
fallback
8. lfs/filter_process.rs — Documented _caps
- Added comment explaining why capabilities are read but unused
9. Tests (4 new, all passing)
- test_push_no_remote_configured — succeeds silently with no remote
- test_pull_local_only_no_network — restores local content, doesn't attempt network
- test_git_add_returns_result — propagates errors properly
- test_smudge_remote_fallback_on_no_server — falls back gracefully when remote
unreachable
Verification
- cargo clippy --no-deps -- -D warnings — clean
- cargo test --lib lfs — 44 tests passed, 0 failed1 parent 59a80a9 commit e60220d
File tree
5 files changed
+365
-37
lines changed- oxen-rust/src/lib/src
- api/client
- lfs
5 files changed
+365
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
229 | 272 | | |
230 | 273 | | |
231 | 274 | | |
232 | 275 | | |
233 | | - | |
234 | 276 | | |
235 | 277 | | |
236 | 278 | | |
237 | | - | |
| 279 | + | |
238 | 280 | | |
239 | 281 | | |
240 | 282 | | |
| |||
254 | 296 | | |
255 | 297 | | |
256 | 298 | | |
257 | | - | |
258 | 299 | | |
259 | 300 | | |
260 | 301 | | |
| |||
298 | 339 | | |
299 | 340 | | |
300 | 341 | | |
301 | | - | |
302 | | - | |
| 342 | + | |
303 | 343 | | |
304 | 344 | | |
305 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
28 | 47 | | |
29 | 48 | | |
30 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | | - | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
71 | 102 | | |
72 | 103 | | |
73 | 104 | | |
| |||
77 | 108 | | |
78 | 109 | | |
79 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
80 | 127 | | |
81 | 128 | | |
82 | 129 | | |
| |||
248 | 295 | | |
249 | 296 | | |
250 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
251 | 319 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
143 | 147 | | |
144 | 148 | | |
145 | 149 | | |
| |||
0 commit comments