Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
refs/files-backend: use the_hash_algo for writing refs
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 16 Jul 2018 01:27:59 +0000
(
01:27
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jul 2018 21:27:39 +0000
(14:27 -0700)
In order to ensure we write the correct amount, use the_hash_algo to
find the correct number of bytes for the current hash.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
7b38efa
)
diff --git
a/refs/files-backend.c
b/refs/files-backend.c
index a9a066dcfb60d83a10e27d1c0d1131faf2ae97a4..c546ffbf5d46c3cceb767ba5e43aa7da1452aac6 100644
(file)
--- a/
refs/files-backend.c
+++ b/
refs/files-backend.c
@@
-1676,7
+1676,7
@@
static int write_ref_to_lockfile(struct ref_lock *lock,
return -1;
}
fd = get_lock_file_fd(&lock->lk);
return -1;
}
fd = get_lock_file_fd(&lock->lk);
- if (write_in_full(fd, oid_to_hex(oid),
GIT_SHA1_HEXSZ
) < 0 ||
+ if (write_in_full(fd, oid_to_hex(oid),
the_hash_algo->hexsz
) < 0 ||
write_in_full(fd, &term, 1) < 0 ||
close_ref_gently(lock) < 0) {
strbuf_addf(err,
write_in_full(fd, &term, 1) < 0 ||
close_ref_gently(lock) < 0) {
strbuf_addf(err,
@@
-3070,7
+3070,7
@@
static int files_reflog_expire(struct ref_store *ref_store,
rollback_lock_file(&reflog_lock);
} else if (update &&
(write_in_full(get_lock_file_fd(&lock->lk),
rollback_lock_file(&reflog_lock);
} else if (update &&
(write_in_full(get_lock_file_fd(&lock->lk),
- oid_to_hex(&cb.last_kept_oid),
GIT_SHA1_HEXSZ
) < 0 ||
+ oid_to_hex(&cb.last_kept_oid),
the_hash_algo->hexsz
) < 0 ||
write_str_in_full(get_lock_file_fd(&lock->lk), "\n") < 0 ||
close_ref_gently(lock) < 0)) {
status |= error("couldn't write %s",
write_str_in_full(get_lock_file_fd(&lock->lk), "\n") < 0 ||
close_ref_gently(lock) < 0)) {
status |= error("couldn't write %s",