Skip to content

Commit 5f0c124

Browse files
committed
doc: Repository::commit() now explains how to create a commit without ref updates.
1 parent 527fd3d commit 5f0c124

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gix/src/repository/object.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl crate::Repository {
342342
/// Create a new commit object with `message` referring to `tree` with `parents`, and point `reference`
343343
/// to it. The commit is written without message encoding field, which can be assumed to be UTF-8.
344344
/// `author` and `committer` fields are pre-set from the configuration, which can be altered
345-
/// [temporarily][crate::Repository::config_snapshot_mut()] before the call if required.
345+
/// [temporarily](crate::Repository::config_snapshot_mut()) before the call if required.
346346
///
347347
/// `reference` will be created if it doesn't exist, and can be `"HEAD"` to automatically write-through to the symbolic reference
348348
/// that `HEAD` points to if it is not detached. For this reason, detached head states cannot be created unless the `HEAD` is detached
@@ -352,6 +352,11 @@ impl crate::Repository {
352352
/// If there is no parent, the `reference` is expected to not exist yet.
353353
///
354354
/// The method fails immediately if a `reference` lock can't be acquired.
355+
///
356+
/// ### Writing a commit without `reference` update
357+
///
358+
/// If the reference shouldn't be updated, use [`Self::write_object()`] along with a newly created [`crate::objs::Object`] whose fields
359+
/// can be fully defined.
355360
pub fn commit<Name, E>(
356361
&self,
357362
reference: Name,

0 commit comments

Comments
 (0)