Skip to content

new architecture: keep track of added/reset files #2

@Laoujin

Description

@Laoujin
  • no config.workingDir & config.stagingArea: put in one list.

object looks like: @{state=$_[0];file=$file;staged=$true}
need to add ;working=$false

Use number indexes for workingDir and alphabet for stagingArea?

all Git-functions should define a config about what they are supposed to do
and be updated on checkout/add/...

$filter = ({
	param($fileInfo)
	$fileInfo.state -ne 'D'
})
$config = @{
	gitCommand="git add";
	staging=$false;
	working=$true;
	defaultToAllFiles=$true;
	extraFileFilterFn=$filter; # only Git-NumberedDiff needs this atm. is this necessary?
}


function Execute-GitConfig($config, $fileInfo) {
	if ($args.length -eq 0 -or $args[0] -eq $null) {
		$args = @("0-$($global:gitStatusNumbers.stagingArea.length - 1)")
	}

	$fileInfos = Parse-GitIndexes $args 'stagingArea'
	if (-not $fileInfos) {
		return
	}

	$files = $fileInfos | % {$_.file}
	Invoke-Git diff --cached $files
}
  • Git-NumberedDiff: Should also work for already staged files
  • Git-NumberedReset: Should also work for not staged files that are then Git-NumberedAdded
  • Git-NumberedAdd/Diff should allow args like -p / --word-diff: ga -p / gdc / gdw / gdcw ?
  • Keep track of added/reset files and use diff --cached to keep gd working
  • Staged file can be added again after a grs

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicProbably requires a lot of work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions