Skip to content

Commit 60c4b42

Browse files
committed
Update for latest git changes
1 parent 643ff21 commit 60c4b42

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

alpm/src/conflict.rs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,19 @@ pub struct Conflict<'a> {
3434

3535
impl<'a> fmt::Debug for Conflict<'a> {
3636
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37-
f.debug_struct("Conflict")
38-
.field("package1", &self.package1())
39-
.field("package1_hash", &self.package1_hash())
40-
.field("package2", &self.package2())
41-
.field("package2_hash", &self.package2_hash())
42-
.field("reason", &self.reason())
43-
.finish()
37+
#[cfg(not(feature = "git"))]
38+
{
39+
f.debug_struct("Conflict")
40+
.field("package1", &self.package1())
41+
.field("package2", &self.package2())
42+
.field("reason", &self.reason())
43+
.finish()
44+
}
45+
// Implement properly when we merge the no handle code
46+
#[cfg(feature = "git")]
47+
{
48+
f.debug_struct("Conflict").finish()
49+
}
4450
}
4551
}
4652

@@ -70,28 +76,42 @@ impl<'a> Conflict<'a> {
7076
self.inner.as_ptr()
7177
}
7278

79+
#[cfg(not(feature = "git"))]
7380
pub fn package1_hash(&self) -> u64 {
7481
#[allow(clippy::useless_conversion)]
7582
unsafe {
7683
(*self.as_ptr()).package1_hash.into()
7784
}
7885
}
7986

87+
#[cfg(not(feature = "git"))]
8088
pub fn package2_hash(&self) -> u64 {
8189
#[allow(clippy::useless_conversion)]
8290
unsafe {
8391
(*self.as_ptr()).package2_hash.into()
8492
}
8593
}
8694

95+
#[cfg(not(feature = "git"))]
8796
pub fn package1(&self) -> &'a str {
8897
unsafe { from_cstr((*self.as_ptr()).package1) }
8998
}
9099

100+
#[cfg(not(feature = "git"))]
91101
pub fn package2(&self) -> &'a str {
92102
unsafe { from_cstr((*self.as_ptr()).package2) }
93103
}
94104

105+
#[cfg(feature = "git")]
106+
pub fn package1(&self) -> &'a str {
107+
unsafe { from_cstr(alpm_pkg_get_name((*self.as_ptr()).package1)) }
108+
}
109+
110+
#[cfg(feature = "git")]
111+
pub fn package2(&self) -> &'a str {
112+
unsafe { from_cstr(alpm_pkg_get_name((*self.as_ptr()).package2)) }
113+
}
114+
95115
pub fn reason(&self) -> Dep<'a> {
96116
unsafe { Dep::from_ptr((*self.as_ptr()).reason) }
97117
}

0 commit comments

Comments
 (0)