git-gud icon indicating copy to clipboard operation
git-gud copied to clipboard

Add Working Directory and Staging Area support to YAML files

Open benthayer opened this issue 4 years ago • 2 comments

Currently, YAML files can change the contents of commits, but we don't use them to change the contents of the WD or SA. We need a syntax for this and an implementation of this.

benthayer avatar Aug 13 '20 16:08 benthayer

One implementation:

'Working Directory':
  base: 'HEAD'
'Staging Area':
  base: 'Working Directory'

This one would set the contents of the working directory to be the same as commit 1

'Working Directory':
  base: '1'
  add-files:
# same as other directives
'Staging Area':
  files:

Base can be HEAD or any of the top level commit-ishs in the YAML

Staging Area defaults to Working Directory and Working Directory defaults to HEAD.

If base is specified, then we can use add-files and remove-files just like we can in commits, otherwise files should be specified.

With this, it might follow that merges and other commits can havie this same framework applied. For merges, you could base the commit off of either parent, and add-files/remove-files would could be used to set the files for the commit

benthayer avatar Aug 13 '20 16:08 benthayer

To start, implementing files for Working Directory and Staging Area would be the easiest.

benthayer avatar Aug 13 '20 16:08 benthayer