Repository navigation
Commit f956ce6
Fix command-line overrides for project files (colmap#4902)
## Summary
Command-line options passed together with `--project_path` were silently
ignored when the same option was present in the project file. This PR
gives explicit command-line values precedence and adds a regression
test.
## Problem
Given a project file containing:
```ini
database_path=/tmp/config.db
image_path=/tmp/images
```
running:
```text
colmap ... --project_path project.ini --database_path /tmp/command-line.db
```
should use `/tmp/command-line.db`, but COLMAP used `/tmp/config.db`
instead.
## Cause
`BaseOptionManager::Parse` parsed the command line, then loaded the
project file through `Read`, which created and notified a separate
variables map. The project-file values therefore replaced the already
parsed command-line state.
## Changes
- Parse project-file options into the existing command-line variables
map, preserving explicit command-line values while still filling options
supplied only by the project file.
- Share project-file parsing and unregistered-option diagnostics between
`Parse` and `Read`.
- Add a regression test covering command-line database-path overrides
and project-file-only image paths.
## Testing
Focused:
`/home/vaishnavi/colmap-flagship-20261026-clean-build/src/colmap/controllers/base_option_manager_test
--gtest_filter=BaseOptionManager.CommandLineOptionsOverrideProjectFile`
— 1 passed on HEAD `0976409702e778bb89db531dd8ab7b8fa10bba06`.
Adjacent: `ctest --test-dir
/home/vaishnavi/colmap-flagship-20261026-clean-build -R
"(base_option_manager_test|option_manager_test)" --output-on-failure` —
2 tests passed: 20 `BaseOptionManager` tests and 14 `OptionManager`
tests.
Format: `clang-format --dry-run --Werror` with clang-format 23.1.3 —
passed. `git diff --check` — passed.
Full suite: not run.
Not covered: changing project-file validation or unsupported-option
handling; this PR only changes precedence when both sources specify an
option.
---------
Co-authored-by: Paul-Edouard Sarlin <[email protected]>
Co-authored-by: Johannes Schönberger <[email protected]>1 parent ce2b5ab commit f956ce6
3 files changed
Lines changed: 132 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
334 | 336 | | |
335 | 337 | | |
336 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
16 | 40 | | |
17 | 41 | | |
18 | 42 | | |
| |||
225 | 249 | | |
226 | 250 | | |
227 | 251 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 252 | + | |
| 253 | + | |
233 | 254 | | |
234 | 255 | | |
| 256 | + | |
235 | 257 | | |
236 | 258 | | |
237 | 259 | | |
238 | | - | |
239 | | - | |
| 260 | + | |
240 | 261 | | |
241 | 262 | | |
242 | 263 | | |
| |||
256 | 277 | | |
257 | 278 | | |
258 | 279 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | 280 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
| 281 | + | |
280 | 282 | | |
281 | 283 | | |
282 | | - | |
283 | | - | |
| 284 | + | |
| 285 | + | |
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
270 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
271 | 287 | | |
272 | 288 | | |
273 | 289 | | |
274 | 290 | | |
275 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
276 | 339 | | |
277 | 340 | | |
278 | 341 | | |
| 342 | + | |
279 | 343 | | |
280 | | - | |
| 344 | + | |
| 345 | + | |
281 | 346 | | |
282 | 347 | | |
283 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
284 | 353 | | |
285 | 354 | | |
286 | 355 | | |
287 | 356 | | |
288 | 357 | | |
289 | | - | |
| 358 | + | |
290 | 359 | | |
291 | 360 | | |
292 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
293 | 366 | | |
294 | | - | |
295 | | - | |
296 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
297 | 384 | | |
298 | 385 | | |
299 | 386 | | |
| |||
0 commit comments