code: def add(self, sha, mode, name, force=False):
          
          if '/' in name:
              raise ValueError("Name must not contain '/' characters")
          if (mode >> 12) not in Tree._map_id_to_type:
              raise ValueError("Invalid object type according to mode %o" % mode)
  
          sha = to_bin_sha(sha)
          index = self._index_by_name(name)
          item = (sha, mode, name)
          if index == -1:
              self._cache.append(item)
          else:
              if force:
                  self._cache[index] = item
              else:
                  ex_item = self._cache[index]
                  if ex_item[0] != sha or ex_item[1] != mode:
                      raise ValueError("Item %r existed with different properties" % name)
                  # END handle mismatch
              # END handle force
          # END handle name exists
          return self
docs: Add the given item to the tree. If an item with the given name already
          exists, nothing will be done, but a ValueError will be raised if the
          sha and mode of the existing item do not match the one you add, unless
          force is True
  
          :param sha: The 20 or 40 byte sha of the item to add
          :param mode: int representing the stat compatible mode of the item
          :param force: If True, an item with your name and information will overwrite
              any existing item with the same name, no matter which information it has
          :return: self