mirror of
https://github.com/vbatts/dedupe-linker.git
synced 2025-07-29 13:30:30 +00:00
*.go: firm up whether it is the same file
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
022dad64e7
commit
2835d1a77d
3 changed files with 23 additions and 16 deletions
16
base/base.go
16
base/base.go
|
@ -53,21 +53,7 @@ type ReadSeekCloser interface {
|
|||
// SameFile checks whether the object of `sum` address, and `path` file path are the same file.
|
||||
// This checks by inode and device.
|
||||
func (b Base) SameFile(sum, path string) bool {
|
||||
var (
|
||||
bInode, dInode uint64
|
||||
err error
|
||||
)
|
||||
if bInode, err = file.GetInode(b.blobPath(sum)); err != nil {
|
||||
return false
|
||||
}
|
||||
if dInode, err = file.GetInode(path); err != nil {
|
||||
return false
|
||||
}
|
||||
if bInode == dInode {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
return file.SameFile(b.blobPath(sum), path)
|
||||
}
|
||||
|
||||
// GetBlob store the content from src, for the sum and hashType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue