Skip to content

Commit 866affd

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

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

gix-object/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub struct Tag {
190190
/// cannot be mutated or serialized. Instead, one will [convert](ObjectRef::into_owned()) them into their [`mutable`](Object) counterparts
191191
/// which support mutation and serialization.
192192
///
193-
/// An `ObjectRef` is representing [`Trees`], [`Blobs`], [`Commits`], or [`Tags`].
193+
/// An `ObjectRef` is representing [`Trees`](TreeRef), [`Blobs`](BlobRef), [`Commits`](CommitRef), or [`Tags`](TagRef).
194194
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
195195
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
196196
#[allow(missing_docs)]
@@ -209,7 +209,7 @@ pub enum ObjectRef<'a> {
209209
/// They either created using object [construction](Object) or by [deserializing existing objects](ObjectRef::from_bytes())
210210
/// and converting these [into mutable copies](ObjectRef::into_owned()) for adjustments.
211211
///
212-
/// An `Object` is representing [`Trees`], [`Blobs`], [`Commits`] or [`Tags`].
212+
/// An `Object` is representing [`Trees`](Tree), [`Blobs`](Blob), [`Commits`](Commit), or [`Tags`](Tag).
213213
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
214214
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
215215
#[allow(clippy::large_enum_variant, missing_docs)]

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)