@@ -10,7 +10,7 @@ use crate::{bstr::BString, ext::ReferenceExt, reference, Reference};
1010impl crate :: Repository {
1111 /// Create a lightweight tag with given `name` (and without `refs/tags/` prefix) pointing to the given `target`, and return it as reference.
1212 ///
13- /// It will be created with `constraint` which is most commonly to [only create it][ PreviousValue::MustNotExist]
13+ /// It will be created with `constraint` which is most commonly to [only create it]( PreviousValue::MustNotExist)
1414 /// or to [force overwriting a possibly existing tag](PreviousValue::Any).
1515 pub fn tag_reference (
1616 & self ,
@@ -135,25 +135,37 @@ impl crate::Repository {
135135
136136 /// Edit one or more references as described by their `edits`.
137137 /// Note that one can set the committer name for use in the ref-log by temporarily
138- /// [overriding the git-config][crate::Repository::config_snapshot_mut()].
138+ /// [overriding the git-config](crate::Repository::config_snapshot_mut()), or use
139+ /// [`edit_references_as(committer)`](Self::edit_references_as()) for convenience.
139140 ///
140141 /// Returns all reference edits, which might be more than where provided due the splitting of symbolic references, and
141142 /// whose previous (_old_) values are the ones seen on in storage after the reference was locked.
142143 pub fn edit_references (
143144 & self ,
144145 edits : impl IntoIterator < Item = RefEdit > ,
146+ ) -> Result < Vec < RefEdit > , reference:: edit:: Error > {
147+ self . edit_references_as ( edits, self . committer ( ) . transpose ( ) ?)
148+ }
149+
150+ /// A way to apply reference `edits` similar to [edit_references(…)](Self::edit_references()), but set a specific
151+ /// `commiter` for use in the reflog. It can be `None` if it's the purpose `edits` are configured to not update the
152+ /// reference log, or cause a failure otherwise.
153+ pub fn edit_references_as (
154+ & self ,
155+ edits : impl IntoIterator < Item = RefEdit > ,
156+ committer : Option < gix_actor:: SignatureRef < ' _ > > ,
145157 ) -> Result < Vec < RefEdit > , reference:: edit:: Error > {
146158 let ( file_lock_fail, packed_refs_lock_fail) = self . config . lock_timeout ( ) ?;
147159 self . refs
148160 . transaction ( )
149161 . prepare ( edits, file_lock_fail, packed_refs_lock_fail) ?
150- . commit ( self . committer ( ) . transpose ( ) ? )
162+ . commit ( committer)
151163 . map_err ( Into :: into)
152164 }
153165
154166 /// Return the repository head, an abstraction to help dealing with the `HEAD` reference.
155167 ///
156- /// The `HEAD` reference can be in various states, for more information, the documentation of [`Head`][ crate::Head] .
168+ /// The `HEAD` reference can be in various states, for more information, the documentation of [`Head`]( crate::Head) .
157169 pub fn head ( & self ) -> Result < crate :: Head < ' _ > , reference:: find:: existing:: Error > {
158170 let head = self . find_reference ( "HEAD" ) ?;
159171 Ok ( match head. inner . target {
@@ -184,7 +196,7 @@ impl crate::Repository {
184196
185197 /// Return the name to the symbolic reference `HEAD` points to, or `None` if the head is detached.
186198 ///
187- /// The difference to [`head_ref()`][ Self::head_ref()] is that the latter requires the reference to exist,
199+ /// The difference to [`head_ref()`]( Self::head_ref()) is that the latter requires the reference to exist,
188200 /// whereas here we merely return a the name of the possibly unborn reference.
189201 pub fn head_name ( & self ) -> Result < Option < FullName > , reference:: find:: existing:: Error > {
190202 Ok ( self . head ( ) ?. referent_name ( ) . map ( std:: borrow:: ToOwned :: to_owned) )
@@ -228,7 +240,7 @@ impl crate::Repository {
228240 /// Find the reference with the given partial or full `name`, like `main`, `HEAD`, `heads/branch` or `origin/other`,
229241 /// or return an error if it wasn't found.
230242 ///
231- /// Consider [`try_find_reference(…)`][ crate::Repository::try_find_reference()] if the reference might not exist
243+ /// Consider [`try_find_reference(…)`]( crate::Repository::try_find_reference()) if the reference might not exist
232244 /// without that being considered an error.
233245 pub fn find_reference < ' a , Name , E > ( & self , name : Name ) -> Result < Reference < ' _ > , reference:: find:: existing:: Error >
234246 where
@@ -249,7 +261,7 @@ impl crate::Repository {
249261
250262 /// Return a platform for iterating references.
251263 ///
252- /// Common kinds of iteration are [all][ crate::reference::iter::Platform::all()] or [prefixed][ crate::reference::iter::Platform::prefixed()]
264+ /// Common kinds of iteration are [all]( crate::reference::iter::Platform::all()) or [prefixed]( crate::reference::iter::Platform::prefixed())
253265 /// references.
254266 pub fn references ( & self ) -> Result < reference:: iter:: Platform < ' _ > , reference:: iter:: Error > {
255267 Ok ( reference:: iter:: Platform {
@@ -261,7 +273,7 @@ impl crate::Repository {
261273 /// Try to find the reference named `name`, like `main`, `heads/branch`, `HEAD` or `origin/other`, and return it.
262274 ///
263275 /// Otherwise return `None` if the reference wasn't found.
264- /// If the reference is expected to exist, use [`find_reference()`][ crate::Repository::find_reference()] .
276+ /// If the reference is expected to exist, use [`find_reference()`]( crate::Repository::find_reference()) .
265277 pub fn try_find_reference < ' a , Name , E > ( & self , name : Name ) -> Result < Option < Reference < ' _ > > , reference:: find:: Error >
266278 where
267279 Name : TryInto < & ' a PartialNameRef , Error = E > ,
0 commit comments