Nguyễn Thái Ngọc Duy [off-list ref] writes:
This function can be potentially used in more places than just
tree-diff.c. "struct diff_options" does not make much sense outside
diff_tree_sha1().
While removing the use of diff_options, it also removes
tree_entry_extract() call, which means S_ISDIR() uses the entry->mode
directly, without being filtered by canon_mode() (called internally
inside tree_entry_extract)
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
The patch looks good, but the second paragraph above sounded unnecessarily
alarming and I had to read it three times to make sure nothing fishy is
going on ;-).
It bypasses tree-entry-extract call and uses fields of "entry" directly.
With the change, entry->mode is used without first getting normalized with
canon_mode(), but the only use of the mode information in this function is
to check the type of the entry by giving it to S_ISDIR() macro, and the
result does not change with or without canon_mode(), so it is Ok.