cascache: add_object, assert path if link_directly
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 005fd98..d9832fe 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -381,6 +381,9 @@
# Exactly one of the two parameters has to be specified
assert (path is None) != (buffer is None)
+ # If we're linking directly, then path must be specified.
+ assert (not link_directly) or (link_directly and path)
+
if digest is None:
digest = remote_execution_pb2.Digest()