Skip to content

Commit 5dd5648

Browse files
meyeringgitster
authored andcommitted
remove tests of always-false condition
* fsck.c (fsck_error_function): Don't test obj->sha1 == 0. It can never be true, since that sha1 member is an array. * transport.c (set_upstreams): Likewise for ref->new_sha1. Signed-off-by: Jim Meyering <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5743350 commit 5dd5648

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...)
350350
int len;
351351
struct strbuf sb = STRBUF_INIT;
352352

353-
strbuf_addf(&sb, "object %s:", obj->sha1?sha1_to_hex(obj->sha1):"(null)");
353+
strbuf_addf(&sb, "object %s:", sha1_to_hex(obj->sha1));
354354

355355
va_start(ap, fmt);
356356
len = vsnprintf(sb.buf + sb.len, strbuf_avail(&sb), fmt, ap);

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
156156
continue;
157157
if (!ref->peer_ref)
158158
continue;
159-
if (!ref->new_sha1 || is_null_sha1(ref->new_sha1))
159+
if (is_null_sha1(ref->new_sha1))
160160
continue;
161161

162162
/* Follow symbolic refs (mainly for HEAD). */

0 commit comments

Comments
 (0)