def update_page(page, name, format, data, commit = {})
      name     ||= page.name
      format   ||= page.format
      dir      = ::File.dirname(page.path)
      dir      = '' if dir == '.'
      filename = (rename = page.name != name) ?
          Gollum::Page.cname(name) : page.filename_stripped

      multi_commit = !!commit[:committer]
      committer    = multi_commit ? commit[:committer] : Committer.new(self, commit)

      if !rename && page.format == format
        committer.add(page.path, normalize(data))
      else
        committer.delete(page.path)
        committer.add_to_index(dir, filename, format, data)
      end

      committer.after_commit do |index, _sha|
        @access.refresh
        index.update_working_dir(dir, page.filename_stripped, page.format)
        index.update_working_dir(dir, filename, format)
      end

      multi_commit ? committer : committer.commit
    end
def update_page(page, name, format, data, commit = {})
      name     ||= page.name
      format   ||= page.format
      dir      = ::File.dirname(page.path)
      dir      = '' if dir == '.'
      filename = (rename = page.name != name) ?
          Gollum::Page.cname(name) : page.filename_stripped

      multi_commit = !!commit[:committer]
      committer    = multi_commit ? commit[:committer] : Committer.new(self, commit)

      if !rename && page.format == format
        committer.add(page.path, normalize(data))
      else
        committer.delete(page.path)
        committer.add_to_index(dir, filename, format, data)
      end

      committer.after_commit do |index, _sha|
        @access.refresh
        index.update_working_dir(dir, page.filename_stripped, page.format)
        index.update_working_dir(dir, filename, format)
      end

      multi_commit ? committer : committer.commit
    end
Public: Update an existing page with new content. The location of the
 page inside the repository will not change. If the given format is
 different than the current format of the page, the filename will be
 changed to reflect the new format.

 page   - The Gollum::Page to update.
 name   - The String extension-less name of the page.
 format - The Symbol format of the page.
 data   - The new String contents of the page.
 commit - The commit Hash details:
          :message   - The String commit message.
          :name      - The String author full name.
          :email     - The String email address.
          :parent    - Optional Gollum::Git::Commit parent to this update.
          :tree      - Optional String SHA of the tree to create the
                       index from.
          :committer - Optional Gollum::Committer instance.  If provided,
                       assume that this operation is part of batch of
                       updates and the commit happens later.

 Returns the String SHA1 of the newly written version, or the
 Gollum::Committer instance if this is part of a batch update.