Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit eb2aa9b

Browse files
committed
plumbing/packfile: do not compute sha1 for already undeltified objects
Signed-off-by: Javi Fontan <jfontan@gmail.com>
1 parent 555a6ca commit eb2aa9b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

plumbing/format/packfile/parser.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,16 @@ func applyPatchBase(ota *objectInfo, data, base []byte) ([]byte, error) {
423423
return nil, err
424424
}
425425

426-
ota.Type = ota.Parent.Type
427-
sha1, err := getSHA1(ota.Type, patched)
428-
if err != nil {
429-
return nil, err
430-
}
426+
if ota.SHA1 == plumbing.ZeroHash {
427+
ota.Type = ota.Parent.Type
428+
sha1, err := getSHA1(ota.Type, patched)
429+
if err != nil {
430+
return nil, err
431+
}
431432

432-
ota.SHA1 = sha1
433-
ota.Length = int64(len(patched))
433+
ota.SHA1 = sha1
434+
ota.Length = int64(len(patched))
435+
}
434436

435437
return patched, nil
436438
}

0 commit comments

Comments
 (0)