filter_ref: avoid overwriting ref->old_sha1 with garbage