Adjust Git_kv.commit to report staging status
The implementation is a bit too naïve and will report the commit dirty even when there are no staged changes. It only detects if we're inside a `change_and_push`.
This commit is contained in:
parent
60795e65e2
commit
3276c90b08
2 changed files with 11 additions and 3 deletions
|
@ -109,7 +109,13 @@ let connect ctx endpoint =
|
|||
|
||||
let branch t = t.branch
|
||||
|
||||
let commit t = t.head
|
||||
let commit t =
|
||||
match t.head, t.committed with
|
||||
| None, _ -> None
|
||||
| Some commit, None -> Some (`Clean commit)
|
||||
| Some commit, Some _ ->
|
||||
(* XXX: this is not precise as we can have made zero changes *)
|
||||
Some (`Dirty commit)
|
||||
|
||||
type key = Mirage_kv.Key.t
|
||||
|
||||
|
|
|
@ -43,8 +43,10 @@ val connect : Mimic.ctx -> string -> t Lwt.t
|
|||
val branch : t -> Git.Reference.t
|
||||
(** [branch t] returns the branch used by the given [t]. *)
|
||||
|
||||
val commit : t -> Digestif.SHA1.t option
|
||||
(** [commit t] returns the commit used by the given [t]. *)
|
||||
val commit : t -> [ `Clean of Digestif.SHA1.t | `Dirty of Digestif.SHA1.t ] option
|
||||
(** [commit t] returns the commit used by the given [t]. The commit is either
|
||||
marked [`Dirty _] if we're inside a [change_and_push] or [`Clean _]
|
||||
otherwise. *)
|
||||
|
||||
val to_octets : ?level:int -> t -> string Lwt_stream.t
|
||||
(** [to_octets ?level store] returns a serialized version of the given [store].
|
||||
|
|
Loading…
Reference in a new issue