Skip to content

Commit b1b6e00

Browse files
committed
[tree-diff] consider that windows does do symlinks differently
Interesting to see how it works there, as technically there is no way of telling it's a symlink.
1 parent 2627df0 commit b1b6e00

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

git-diff/tests/visit/mod.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,33 @@ mod changes {
166166
":100644 100644 28ce6a8b26aa170e1de65536fe8abe1832bd3242 13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a M f/f"
167167
);
168168

169+
#[cfg(target_os = "windows")]
170+
let tree_with_link_id = hex_to_id("3b287f8730c81d0b763c2d294618a5e32b67b4f8");
171+
#[cfg(target_os = "windows")]
172+
let link_entry_oid = hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
173+
#[cfg(target_os = "windows")]
174+
let link_entry_mode = EntryMode::Blob;
175+
#[cfg(not(target_os = "windows"))]
176+
let tree_with_link_id = hex_to_id("7e26dba59b6336f87d1d4ae3505a2da302b91c76");
177+
#[cfg(not(target_os = "windows"))]
178+
let link_entry_oid = hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e");
179+
#[cfg(not(target_os = "windows"))]
180+
let link_entry_mode = EntryMode::Link;
169181
assert_eq!(
170182
diff_with_previous_commit_from(&db, &all_commits[8])?,
171183
vec![
172184
recorder::Change::Modification {
173185
previous_entry_mode: EntryMode::Tree,
174186
previous_oid: hex_to_id("849bd76db90b65ebbd2e6d3970ca70c96ee5592c"),
175187
entry_mode: EntryMode::Tree,
176-
oid: hex_to_id("7e26dba59b6336f87d1d4ae3505a2da302b91c76"),
188+
oid: tree_with_link_id.clone(),
177189
path: "f".into()
178190
},
179191
recorder::Change::Modification {
180192
previous_entry_mode: EntryMode::Blob,
181193
previous_oid: hex_to_id("13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a"),
182-
entry_mode: EntryMode::Link,
183-
oid: hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e"),
194+
entry_mode: link_entry_mode,
195+
oid: link_entry_oid.clone(),
184196
path: "f/f".into()
185197
},
186198
],
@@ -192,7 +204,7 @@ mod changes {
192204
vec![
193205
recorder::Change::Deletion {
194206
entry_mode: EntryMode::Tree,
195-
oid: hex_to_id("7e26dba59b6336f87d1d4ae3505a2da302b91c76"),
207+
oid: tree_with_link_id,
196208
path: "f".into()
197209
},
198210
recorder::Change::Addition {
@@ -211,8 +223,8 @@ mod changes {
211223
path: "f/b".into()
212224
},
213225
recorder::Change::Deletion {
214-
entry_mode: EntryMode::Link,
215-
oid: hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e"),
226+
entry_mode: link_entry_mode,
227+
oid: link_entry_oid,
216228
path: "f/f".into()
217229
},
218230
],

0 commit comments

Comments
 (0)