Skip to content

Commit 2afab9f

Browse files
authored
Derive Debug for IndexEntry, IndexTime, and Time (#762)
Sometimes it's useful to quickly dump an IndexEntry for debugging; having a `Debug` impl helps. Derive `Debug` for several time-related types (as well as the underlying structures in libgit2-sys).
1 parent 4461b17 commit 2afab9f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

libgit2-sys/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub struct git_signature {
143143
}
144144

145145
#[repr(C)]
146-
#[derive(Copy, Clone, Eq, PartialEq)]
146+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
147147
pub struct git_time {
148148
pub time: git_time_t,
149149
pub offset: c_int,
@@ -817,7 +817,7 @@ pub const GIT_INDEX_ENTRY_STAGEMASK: u16 = 0x3000;
817817
pub const GIT_INDEX_ENTRY_STAGESHIFT: u16 = 12;
818818

819819
#[repr(C)]
820-
#[derive(Copy, Clone, Eq, PartialEq)]
820+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
821821
pub struct git_index_time {
822822
pub seconds: i32,
823823
pub nanoseconds: u32,

src/index.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub type IndexMatchedPath<'a> = dyn FnMut(&Path, &[u8]) -> i32 + 'a;
5454
/// All fields of an entry are public for modification and inspection. This is
5555
/// also how a new index entry is created.
5656
#[allow(missing_docs)]
57+
#[derive(Debug)]
5758
pub struct IndexEntry {
5859
pub ctime: IndexTime,
5960
pub mtime: IndexTime,

src/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use crate::raw;
66
use crate::util::Binding;
77

88
/// Time in a signature
9-
#[derive(Copy, Clone, Eq, PartialEq)]
9+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
1010
pub struct Time {
1111
raw: raw::git_time,
1212
}
1313

1414
/// Time structure used in a git index entry.
15-
#[derive(Copy, Clone, Eq, PartialEq)]
15+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
1616
pub struct IndexTime {
1717
raw: raw::git_index_time,
1818
}

0 commit comments

Comments
 (0)