[DB] kill abs_source_file_from_path

Summary:
`abs_source_file_from_path` is dangerous because
1. It's not trying to make path relative to `project_root` - you can't compare two files created with two different methods
2. It's making relative paths relative to `getcwd` instead of `project_root` which is different from `from_string` function.

Also remove unused `DB.inode_equal`

Reviewed By: cristianoc

Differential Revision: D4204891

fbshipit-source-id: c4c2f99
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent 7d22130deb
commit 7a5e53262a

@ -56,10 +56,6 @@ let source_file_from_string path =
else
Absolute path
(** convert a path to a source file, turning it into an absolute path if necessary *)
let abs_source_file_from_path fname =
Absolute (filename_to_absolute fname)
let rel_path_from_abs_path root fname =
let relative_complemented_fname = filename_to_relative root fname in
if string_is_prefix root fname &&
@ -100,11 +96,6 @@ let source_file_line_count source_file =
let abs_path = source_file_to_abs_path source_file in
count_newlines abs_path
let inode_equal sf1 sf2 =
let stat1 = Unix.stat (source_file_to_abs_path sf1) in
let stat2 = Unix.stat (source_file_to_abs_path sf2) in
stat1.st_dev = stat2.st_dev && stat1.st_ino = stat2.st_ino
let source_file_to_rel_path fname =
match fname with
| RelativeProjectRoot path -> path

@ -95,15 +95,9 @@ val source_file_line_count : source_file -> int
(** equality of source files *)
val source_file_equal : source_file -> source_file -> bool
(** equality of the files on disk *)
val inode_equal : source_file -> source_file -> bool
(** empty source file *)
val source_file_empty : source_file
(** convert a path to a source file, turning it into an absolute path if necessary *)
val abs_source_file_from_path : string -> source_file
val source_file_from_abs_path : string -> source_file
(** string encoding of a source file (including path) as a single filename *)

Loading…
Cancel
Save