提交 ab47df2d 编写于 作者: B brian m. carlson 提交者: Junio C Hamano

builtin/merge: switch to use the_hash_algo

Switch uses of GIT_SHA1_HEXSZ to use the_hash_algo instead.
Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 5188eb5d
......@@ -1034,6 +1034,7 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge
const char *filename;
int fd, pos, npos;
struct strbuf fetch_head_file = STRBUF_INIT;
const unsigned hexsz = the_hash_algo->hexsz;
if (!merge_names)
merge_names = &fetch_head_file;
......@@ -1059,16 +1060,16 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge
else
npos = merge_names->len;
if (npos - pos < GIT_SHA1_HEXSZ + 2 ||
if (npos - pos < hexsz + 2 ||
get_oid_hex(merge_names->buf + pos, &oid))
commit = NULL; /* bad */
else if (memcmp(merge_names->buf + pos + GIT_SHA1_HEXSZ, "\t\t", 2))
else if (memcmp(merge_names->buf + pos + hexsz, "\t\t", 2))
continue; /* not-for-merge */
else {
char saved = merge_names->buf[pos + GIT_SHA1_HEXSZ];
merge_names->buf[pos + GIT_SHA1_HEXSZ] = '\0';
char saved = merge_names->buf[pos + hexsz];
merge_names->buf[pos + hexsz] = '\0';
commit = get_merge_parent(merge_names->buf + pos);
merge_names->buf[pos + GIT_SHA1_HEXSZ] = saved;
merge_names->buf[pos + hexsz] = saved;
}
if (!commit) {
if (ptr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册