docs: def get_git_postversion(addon_dir):
      """ return the addon version number, with a developmental version increment
      if there were git commits in the addon_dir after the last version change.
  
      If the last change to the addon correspond to the version number in the
      manifest it is used as is for the python package version. Otherwise a
      counter is incremented for each commit and resulting version number has
      the following form: [8|9].0.x.y.z.1devN, N being the number of git
      commits since the version change.
  
      Note: we use .99.devN because:
      * pip ignores .postN  by design (https://github.com/pypa/pip/issues/2872)
      * x.y.z.devN is anterior to x.y.z
  
      Note: we don't put the sha1 of the commit in the version number because
      this is not PEP 440 compliant and is therefore misinterpreted by pip.
      """
      addon_dir = os.path.realpath(addon_dir)
      last_version = read_manifest(addon_dir).get('version', '0.0.0')
      last_version_parsed = parse_version(last_version)
      if not is_git_controlled(addon_dir):
          return last_version
      if get_git_uncommitted(addon_dir):
          uncommitted = True
          count = 1
      else:
          uncommitted = False
          count = 0
      last_sha = None
      git_root = get_git_root(addon_dir)
      for sha in git_log_iterator(addon_dir):
          try:
              manifest = read_manifest_from_sha(sha, addon_dir, git_root)
          except NoManifestFound:
              break
          version = manifest.get('version', '0.0.0')
          version_parsed = parse_version(version)
          if version_parsed != last_version_parsed:
              break
          if last_sha is None:
              last_sha = sha
          else:
              count += 1
      if not count:
          return last_version
      if last_sha:
          return last_version + ".99.dev%s" % count
      if uncommitted:
          return last_version + ".dev1"
      # if everything is committed, the last commit
      # must have the same version as current,
      # so last_sha must be set and we'll never reach this branch
      return last_version