Skip to content

Commit

Permalink
Move [System.fingerprint] to Fingerprint module
Browse files Browse the repository at this point in the history
This function being in the System module seems to be a simple mishap.
  • Loading branch information
tleedjarv committed Sep 26, 2023
1 parent 9a41cab commit 19658b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
11 changes: 10 additions & 1 deletion src/fingerprint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ let file fspath path =
let f = Fspath.concat fspath path in
Util.convertUnixErrorsToTransient
("digesting " ^ Fspath.toPrintString f)
(fun () -> Fs.fingerprint f)
(fun () ->
let ic = Fs.open_in_bin f in
try
let d = Digest.channel ic (-1) in
close_in ic;
d
with e ->
close_in_noerr ic;
raise e
)

let maxLength = Uutil.Filesize.ofInt max_int
let subfile path offset len =
Expand Down
2 changes: 0 additions & 2 deletions src/fs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ let acl_set_text f acl = System.acl_set_text (path f) acl

(****)

let fingerprint f = System.fingerprint (path f)

let hasInodeNumbers () = System.hasInodeNumbers ()
let hasSymlink () = System.hasSymlink ()
let hasCorrectCTime = System.hasCorrectCTime
12 changes: 0 additions & 12 deletions src/system/system_generic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,6 @@ let has_stderr ~info:_ = true

(****)

let fingerprint f =
let ic = open_in_bin f in
try
let d = Digest.channel ic (-1) in
close_in ic;
d
with e ->
close_in_noerr ic;
raise e

(****)

exception XattrNotSupported
let _ = Callback.register_exception "XattrNotSupported" XattrNotSupported

Expand Down
1 change: 0 additions & 1 deletion src/system/system_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ val openfile :
val open_out_gen : open_flag list -> int -> fspath -> out_channel
val open_in_bin : fspath -> in_channel
val file_exists : fspath -> bool
val fingerprint : fspath -> Digest.t

(****)

Expand Down

0 comments on commit 19658b2

Please sign in to comment.