Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 102 additions & 43 deletions test/Add-Change.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ Feature: Add changes to a repo
Scenario: Add-Change should have similar parameters to git add
Given we have a command Add-Change
Then it should have parameters:
| Name | Type |
| PathSpec | String[] |
| Force | Switch |
| Update | Switch |
| All | Switch |
| NoRemove | Switch |
# -Force could also be called -IncludeIgnored since that is it's only purpose
# -NoRemove translates to --no-all
# ignoring --intent-to-add, --refresh, --interactive, --patch, --edit for the time being
# -ErrorAction Continue translates to --ignore-errors, but that would be default
# -WhatIf translates to --dry-run
# -Verbose translates to -verbose (duh)
| Name | Type |
| [PathSpec] | String[] |
| IncludeIgnored | Switch |
| UpdateStagedChanges | Switch |
| All | Switch |
| IgnoreDeletedChanges | Switch |
# -IncludeIgnored maps to --force
# -UpdateExisting maps to --update
# -IgnoreDeletedChanges maps to --no-all
# -ErrorAction Continue maps to --ignore-errors, but that would be default
# -WhatIf maps to --dry-run
# -Verbose maps to -verbose (duh)
# Do you normally also list the common parameters (WhatIf, Verbose, ErrorAction) here?
# ignoring --intent-to-add, --refresh, --interactive, --patch, --edit for the time being

@wip
Scenario: There's no repository
Expand All @@ -31,67 +32,125 @@ Scenario: There's no repository
@wip
Scenario: stage a change in an untracked file
Given we have initialized a repository by running New-Repository
And there is an untracked file called NewFile.txt
And there is an untracked file called NewFile.txt in the working directory
When Add-Change NewFile.txt is called
And I ask git for a status
Then the status info should show that there are changes on the current branch
And the changes are in a file that is added to the staging area
And the added file is called NewFile.txt
| ChangeState | FileName |
| added | NewFile.txt |

# This is somewhat similar to Ignored Files from Changes.feature
@wip
Scenario: stage a change in an ignored file
Given we have initialized a repository by running New-Repository
And the .gitignore file contains the glob *.ignored
When Add-Change ToBe.ignored is called
Then nothing changes
When Add-Change ToBe.ignored -Force is called
And I ask git for a status
Then the status info should show that nothing changed
When Add-Change ToBe.ignored -IncludeIgnored is called
And I ask git for a status
Then the status info should show that there are changes on the current branch
And the changes are in a new file added to the staging area
And the added file is called ToBe.ignored
| ChangeState | FileName |
| added | ToBe.ignored |

# This is the same as Added and Modified files from Changes.feature, but using Add-Change to add files tot he index
# This is the same as Added and Modified files from Changes.feature, but using Add-Change to add files to the index
@wip
Scenario: add more changes to an existing change in the staging area
Given we have a repository with
| ChangeState | FileName |
| ChangeState | FileName |
| Committed | TrackedFile.txt |
| Committed | FileToDelete.txt |
And there is an untracked file called NewFile.txt
And I have deleted FileToDelete.txt from the working directory
When I change the content of TrackedFile.txt
And Add-Change -Update is called
And there is an untracked file NewFile.txt in a subfolder NewFolder of the working directory
And FileToDelete.txt is deleted from the working directory
And there is a modified version of TrackedFile.txt in the working directory
When Add-Change -UpdateStagedChanges is called
And I ask git for a status
Then the status info should show that there are changes on the current branch
And there are changes in a file is called TrackedFile.txt
And the file FileToBeDeleted.txt deleted from the staging area
And there is an untracked file called NewFile.txt
| ChangeState | FileName |
| modified | TrackedFile.txt |
| deleted | FileToDelete.txt |
| untracked | NewFolder/NewFile.txt |

@wip
Scenario: add more changes to the staging area
Given we have a repository with
| ChangeState | FileName |
| ChangeState | FileName |
| Committed | TrackedFile.txt |
| Committed | FileToDelete.txt |
And there is an untracked file NewFile.txt in a subfolder NewFolder of the working directory
And I have deleted FileToDelete.txt from the working directory
And I have changed the content of TrackedFile.txt in the working directory
When Add-Change -All is called
And I ask git for a status
Then the status info should show that there are changes on the current branch
| ChangeState | FileName |
| modified | TrackedFile.txt |
| added | NewFolder/NewFile.txt |
| deleted | FileToDelete.txt |

# same as above, but with piping the changes to Add-Change instead of calling -All
@wip
Scenario: add more changes to the staging area
Given we have a repository with
| ChangeState | FileName |
| Committed | TrackedFile.txt |
| Committed | FileToDelete.txt |
And there is an untracked file called NewFile.txt
And there is an untracked file called NewFile.txt in the working directory
And I have deleted FileToDelete.txt from the working directory
When I change the content of TrackedFile.txt
And Add-Change -All is called
And I have changed the content of TrackedFile.txt in the working directory
When Get-Change | Add-Change is called
And I ask git for a status
Then the status info should show that there are changes on the current branch
And there are changes in a file is called TrackedFile.txt
And the file FileToDelete.txt deleted from the staging area
And there are changes in a new file added to the staging area
And the added file called NewFile.txt
| ChangeState | FileName |
| modified | TrackedFile.txt |
| added | NewFile.txt |
| deleted | FileToDelete.txt |

@wip
Scenario: add more changes to the staging area but remove nothing
Given we have a repository with
| ChangeState | FileName |
| ChangeState | FileName |
| Committed | TrackedFile.txt |
| Committed | FileToDelete.txt |
And there is an untracked file called NewFile.txt
And there is an untracked file called NewFile.txt in the working directory
And I have deleted FileToDelete.txt from the working directory
When I change the content of TrackedFile.txt
And Add-Change -NoDelete is called
And I have changed the content of TrackedFile.txt in the working directory
When Add-Change -IgnoreDeletedChanges is called
And I ask git for a status
Then the status info should show that there are changes on the current branch
And there are changes in a file is called TrackedFile.txt
And there are changes in a new file added to the staging area
And the added file called NewFile.txt
| ChangeState | FileName |
| modified | TrackedFile.txt |
| added | NewFile.txt |

@wip
Scenario: add more changes to the staging area and provide verbose output
Given we have a repository with
| ChangeState | FileName |
| Committed | TrackedFile.txt |
| Committed | FileToDelete.txt |
And there is an untracked file called NewFile.txt in the working directory
And I have deleted FileToDelete.txt from the working directory
And I have changed the content of TrackedFile.txt in the working directory
When Add-Change -All -Verbose is called
Then the output should show that the changes made to the staging area
| ChangeState | FileName |
| modify | TrackedFile.txt |
| add | NewFile.txt |
| delete | FileToDelete.txt |

@wip
Scenario: add more changes to the staging area and provide verbose output
Given we have a repository with
| ChangeState | FileName |
| Committed | TrackedFile.txt |
| Committed | FileToDelete.txt |
And there is an untracked file called NewFile.txt in the working directory
And I have deleted FileToDelete.txt from the working directory
And I have changed the content of TrackedFile.txt in the working directory
When Add-Change -All -WhatIf is called
Then the output should show that the changes made to the staging area
| ChangeState | FileName |
| modify | TrackedFile.txt |
| add | NewFile.txt |
| delete | FileToDelete.txt |
But the changes were not applied to the staging area