From f134ad61e3963546048e2414596966423b8b511e Mon Sep 17 00:00:00 2001 From: Christoph Murczek Date: Wed, 10 Jun 2015 23:31:34 +0200 Subject: [PATCH 1/3] updated scenarios to use tabular form --- test/Add-Change.feature | 45 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/test/Add-Change.feature b/test/Add-Change.feature index dbe5959..696ef24 100644 --- a/test/Add-Change.feature +++ b/test/Add-Change.feature @@ -31,7 +31,7 @@ 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 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 @@ -53,45 +53,46 @@ Scenario: stage a change in an ignored file @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 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 -Update is called 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 | 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 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 + When I change the content of TrackedFile.txt in the working directory And Add-Change -All is called 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 | + And the file FileToDelete.txt was removed from the staging area @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 + When I change the content of TrackedFile.txt in the working directory And Add-Change -NoDelete is called 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 | From 2a832a7319d61f48fdf6074caaa5ad3bc1eddb01 Mon Sep 17 00:00:00 2001 From: Christoph Murczek Date: Sat, 13 Jun 2015 15:24:11 +0200 Subject: [PATCH 2/3] Feature: Add changes to a repo In order to track changes with Git, changes need to be added to the staging area a.k.a. the index That's what Add-Change does. @wip 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[] | | IncludeIgnored | Switch | | UpdateStagedChanges | Switch | | All | Switch | | NoRemove | Switch | # -IncludeIgnored maps to --force # -UpdateExisting maps to --update # -NoRemove 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 Given we are NOT in a repository When Add-Change is called Then the output should be a warning: "The path is not in a git repository!" #This is the same as Added Files to Stage from Changes.feature, but using Add-Change to add the files to the index @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 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 | 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 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 | ChangeState | FileName | | added | ToBe.ignored | # 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 | | Committed | TrackedFile.txt | | Committed | FileToDelete.txt | And there is an untracked file NewFile.txt in 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 | ChangeState | FileName | | modified | TrackedFile.txt | | deleted | FileToDelete.txt | | untracked | NewFile.txt | @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 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 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 | 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 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 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 | 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 | | 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 -NoDelete 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 | 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 | --- test/Add-Change.feature | 97 +++++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 28 deletions(-) diff --git a/test/Add-Change.feature b/test/Add-Change.feature index 696ef24..a088085 100644 --- a/test/Add-Change.feature +++ b/test/Add-Change.feature @@ -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 | + | NoRemove | Switch | +# -IncludeIgnored maps to --force +# -UpdateExisting maps to --update +# -NoRemove 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 @@ -33,9 +34,10 @@ 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 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 @@ -43,13 +45,15 @@ 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 @@ -59,7 +63,8 @@ Scenario: add more changes to an existing change in the staging area And there is an untracked file NewFile.txt in 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 -Update is called + 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 | ChangeState | FileName | | modified | TrackedFile.txt | @@ -74,13 +79,32 @@ Scenario: add more changes to the staging area | 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 - When I change the content of TrackedFile.txt in the working directory - And Add-Change -All is called + 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 | NewFile.txt | - And the file FileToDelete.txt was removed from the staging area + | ChangeState | FileName | + | modified | TrackedFile.txt | + | added | 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 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 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 + | ChangeState | FileName | + | modified | TrackedFile.txt | + | added | NewFile.txt | + | deleted | FileToDelete.txt | @wip Scenario: add more changes to the staging area but remove nothing @@ -90,9 +114,26 @@ Scenario: add more changes to the staging area but remove nothing | 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 - When I change the content of TrackedFile.txt in the working directory - And Add-Change -NoDelete is called + And I have changed the content of TrackedFile.txt in the working directory + When Add-Change -NoDelete 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 | 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 | \ No newline at end of file From 72a1e3841da1173fb6d0c959a3ba781759f743c5 Mon Sep 17 00:00:00 2001 From: Christoph Murczek Date: Fri, 19 Jun 2015 21:54:54 +0200 Subject: [PATCH 3/3] renamed -NoRemove to -IgnoreDeletedChanges added a scenario for -WhatIf edited the scenarios for -All and -UpdateStagedChanges to reflect the "walks the whole directory tree" behavior --- test/Add-Change.feature | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/test/Add-Change.feature b/test/Add-Change.feature index a088085..0d4d9f1 100644 --- a/test/Add-Change.feature +++ b/test/Add-Change.feature @@ -7,15 +7,15 @@ 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[] | - | IncludeIgnored | Switch | - | UpdateStagedChanges | Switch | - | All | Switch | - | NoRemove | Switch | + | Name | Type | + | [PathSpec] | String[] | + | IncludeIgnored | Switch | + | UpdateStagedChanges | Switch | + | All | Switch | + | IgnoreDeletedChanges | Switch | # -IncludeIgnored maps to --force # -UpdateExisting maps to --update -# -NoRemove maps to --no-all +# -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) @@ -60,7 +60,7 @@ Scenario: add more changes to an existing change in the staging area | ChangeState | FileName | | Committed | TrackedFile.txt | | Committed | FileToDelete.txt | - And there is an untracked file NewFile.txt in the working directory + 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 @@ -69,7 +69,7 @@ Scenario: add more changes to an existing change in the staging area | ChangeState | FileName | | modified | TrackedFile.txt | | deleted | FileToDelete.txt | - | untracked | NewFile.txt | + | untracked | NewFolder/NewFile.txt | @wip Scenario: add more changes to the staging area @@ -77,7 +77,7 @@ Scenario: add more changes to the staging area | ChangeState | FileName | | Committed | TrackedFile.txt | | Committed | FileToDelete.txt | - And there is an untracked file called NewFile.txt in the working directory + 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 @@ -85,7 +85,7 @@ Scenario: add more changes to the staging area Then the status info should show that there are changes on the current branch | ChangeState | FileName | | modified | TrackedFile.txt | - | added | NewFile.txt | + | added | NewFolder/NewFile.txt | | deleted | FileToDelete.txt | # same as above, but with piping the changes to Add-Change instead of calling -All @@ -115,7 +115,7 @@ Scenario: add more changes to the staging area but remove nothing 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 -NoDelete is called + 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 | ChangeState | FileName | @@ -136,4 +136,21 @@ Scenario: add more changes to the staging area and provide verbose output | ChangeState | FileName | | modify | TrackedFile.txt | | add | NewFile.txt | - | delete | FileToDelete.txt | \ No newline at end of file + | 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 \ No newline at end of file