mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-05 22:36:08 +00:00
Merge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash
git_futils_readbuffer: don't compute sha-1
This commit is contained in:
commit
0b3623ac47
@ -196,28 +196,29 @@ int git_futils_readbuffer_updated(
|
|||||||
|
|
||||||
p_close(fd);
|
p_close(fd);
|
||||||
|
|
||||||
if ((error = git_hash_buf(&checksum_new, buf.ptr, buf.size)) < 0) {
|
if (checksum) {
|
||||||
git_buf_free(&buf);
|
if ((error = git_hash_buf(&checksum_new, buf.ptr, buf.size)) < 0) {
|
||||||
return error;
|
git_buf_free(&buf);
|
||||||
}
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we were given a checksum, we only want to use it if it's different
|
* If we were given a checksum, we only want to use it if it's different
|
||||||
*/
|
*/
|
||||||
if (checksum && !git_oid__cmp(checksum, &checksum_new)) {
|
if (!git_oid__cmp(checksum, &checksum_new)) {
|
||||||
git_buf_free(&buf);
|
git_buf_free(&buf);
|
||||||
if (updated)
|
if (updated)
|
||||||
*updated = 0;
|
*updated = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
git_oid_cpy(checksum, &checksum_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're here, the file did change, or the user didn't have an old version
|
* If we're here, the file did change, or the user didn't have an old version
|
||||||
*/
|
*/
|
||||||
if (checksum)
|
|
||||||
git_oid_cpy(checksum, &checksum_new);
|
|
||||||
|
|
||||||
if (updated != NULL)
|
if (updated != NULL)
|
||||||
*updated = 1;
|
*updated = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user