Skip to content

CheckoutBuilder: bind baseline{,_index}#1303

Closed
jonathantanmy2 wants to merge 1 commit into
rust-lang:mainfrom
gitbutlerapp:jt/bindbaseline
Closed

CheckoutBuilder: bind baseline{,_index}#1303
jonathantanmy2 wants to merge 1 commit into
rust-lang:mainfrom
gitbutlerapp:jt/bindbaseline

Conversation

@jonathantanmy2

Copy link
Copy Markdown

Add support for the baseline and baseline_index fields in CheckoutBuilder (to struct git_checkout_options).

Regarding lifetime of arguments passed to CheckoutBuilder, unlike the other fields in which owned versions are created upon function invocation, CheckoutBuilder only takes references to the input tree (baseline()) and index (baseline_index()) respectively. The Rust borrow checker enforces that the references live at least as long as CheckoutBuilder does.

Regarding safety of conversion of these new fields from CheckoutBuilder to struct git_checkout_options (in configure()), it is as unsafe as it currently is: the resulting struct git_checkout_options is valid as long as the source CheckoutBuilder lives.

Add support for the `baseline` and `baseline_index` fields in
CheckoutBuilder (to `struct git_checkout_options`).

Regarding lifetime of arguments passed to CheckoutBuilder, unlike
the other fields in which owned versions are created upon function
invocation, CheckoutBuilder only takes references to the input tree
(`baseline()`) and index (`baseline_index()`) respectively. The Rust
borrow checker enforces that the references live at least as long as
CheckoutBuilder does.

Regarding safety of conversion of these new fields from CheckoutBuilder
to `struct git_checkout_options` (in `configure()`), it is as unsafe as
it currently is: the resulting `struct git_checkout_options` is valid as
long as the source CheckoutBuilder lives.
@rustbot rustbot added the S-waiting-on-review Status: Waiting on review label Jul 22, 2026
@jonathantanmy2

Copy link
Copy Markdown
Author

Sorry, duplicate to #1284.

@rustbot rustbot removed the S-waiting-on-review Status: Waiting on review label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants