You are here: start » en » Internal Documentation » DokuWiki extensions (WvdS) » ADO-Git » Edit a file and commit from the wiki

Edit a file and commit from the wiki

Situation

A single file in a mounted repository needs correcting — a typo in the README, a value in a configuration file — without a git client and without a local copy.

Solution overview

The repository browser offers an editor for single files. It requires write permission (level 8) on the mount namespace; at a lower level the button is absent.

The commit applies against the revision the editor loaded. If the file has changed meanwhile, the server rejects the commit rather than silently overwriting someone else's change.

The service account submits the commit to Azure DevOps. pushedBy there is therefore the service account, while the commit author remains the wiki user; name and email address are taken from their profile.

Implementation

  1. Open the page carrying the {{wk:adogit>…}} markup, for example the repos page of your project. The whole path from the start is described in the tutorial.
  2. Find the file in the tree. If you have write permission, the Edit button sits beside it.
  3. Choose Edit. The editor opens with the fields File content and Commit message.
  4. Edit the content and enter a commit message.
  5. Choose Commit. The change goes straight onto the branch shown in the browser header.

The server answers with one of five states.

State Meaning What you do
ok the commit is applied nothing; the tree shows the new state
denied you lack write permission on the mount namespace ask for a higher tier on the mount
conflict the file changed while you were editing close the editor, open the file again and repeat the change
rejected the path, branch or content failed validation correct the path or the branch
error authentication, transport or an unexpected answer from the server see Diagnostics

A new branch or tag

When a change does not belong on the branch shown, create a new one. The header of the browser carries the New branch/tag button, visible only with write permission.

  1. Choose New branch/tag.
  2. Choose the kind (branch or tag), enter the new name and confirm.
  3. The new branch or tag is created at the tip of the branch the browser is pinned to.

An existing name is not overwritten; the server answers with the conflict state.

To see the new branch as well, enter its name as the fourth field of the markup on the page:

{{wk:adogit>wvds:DokuWiki-Plugins:wkdoadogit:users/jsmith/fix}}

Remarks

  • The Branches and Tags tabs in the header are inactive. You choose the branch shown in the markup on the page, not in the interface. Creating a new branch is therefore possible, switching to it only by editing the page.
  • The editor handles one file at a time. For several files in one commit use git clone; see cloning a repository.
  • No personal token is needed here. Inside the wiki, DokuWiki's permissions decide; the token is meant for external git clients.
  • Every call is checked again. Editing and committing run through calls that check the permission server-side; the button is a convenience, not a licence.
  • The editor does not open binary or oversized files. It returns a state instead of the content.
  • There is no partial success. If the commit fails, nothing in the repository has changed.
en/wiki/dwe/wkdoadogit/howto-edit.txt · Last modified: by 0.0.0.0