Skip to content

Commit f8a659c

Browse files
committed
t/git-lfs-test-server-api: fix reversed conditional
A refactor to this code, 3180a2d ("tq: use Rel() function to implement multiActionSet", 2017-03-06), transformed various lookups such that when a link, ok pair was returned, a check for ok became a check for link being non-nil, and a check for !ok became a check for link being nil. This is consistent with what the actual code does in this case: if there's no link, a nil is returned for the link, and a nil error is returned; otherwise, a valid link is returned, possibly with an error. However, one of the places refactored was accidentally reversed, so we complained that a link should not exist, and then reported that the value received was in fact nil (which means that the link does not exist—exactly what we were hoping for). Reverse the sense of the check, so that we're testing what we want and so that this test program passes when run.
1 parent 44ae87f commit f8a659c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/git-lfs-test-server-api/testupload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func uploadAllExists(manifest *tq.Manifest, oidsExist, oidsMissing []TestObject)
5252
var errbuf bytes.Buffer
5353
for _, o := range retobjs {
5454
link, _ := o.Rel("upload")
55-
if link == nil {
55+
if link != nil {
5656
errbuf.WriteString(fmt.Sprintf("Upload link should not exist for %s, was %+v\n", o.Oid, link))
5757
}
5858
}

0 commit comments

Comments
 (0)