Skip to content

Commit

Permalink
remove tests of always-false condition
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
meyering authored and gitster committed May 26, 2011
1 parent 5743350 commit 5dd5648
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...)
int len;
struct strbuf sb = STRBUF_INIT;

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

va_start(ap, fmt);
len = vsnprintf(sb.buf + sb.len, strbuf_avail(&sb), fmt, ap);
Expand Down
2 changes: 1 addition & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
continue;
if (!ref->peer_ref)
continue;
if (!ref->new_sha1 || is_null_sha1(ref->new_sha1))
if (is_null_sha1(ref->new_sha1))
continue;

/* Follow symbolic refs (mainly for HEAD). */
Expand Down

0 comments on commit 5dd5648

Please sign in to comment.