Skip to content

Commit

Permalink
Revert "fix: no need to run git clean -df since untracked changes a…
Browse files Browse the repository at this point in the history
…re stashed"

This reverts commit 869bac6.
  • Loading branch information
iiroj committed Nov 14, 2019
1 parent bf532c2 commit e58ebbf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/gitWorkflow.js
Expand Up @@ -68,14 +68,16 @@ class GitWorkflow {
debug('Done backing up merge state!')
}

// Save stash of entire original state, including unstaged and untracked changes.
// This should remove all changes from the index.
// The `--keep-index` option cannot be used since it resurrects deleted files on
// git versions before v2.23.0 (https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt#L322)
// Get stash of entire original state, including unstaged changes
await this.execGit(['stash', 'save', '--quiet', '--include-untracked', STASH])
// Apply only the staged changes back to index
// Apply index from previous stash back to enable running tasks against
// staged files only. `git stash --keep-index` cannot be used here because of
// a bug affecting deleted files. The bug has been fixed in git v2.23.0
// See https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt#L322
await this.execGit(['stash', 'apply', '--index', await this.getBackupStash()])
// Checkout everything just in case there are unstaged files left behind.
// Clear any unstaged changes since they are saved in the stash,
// and shouldn't be affected by tasks
await this.execGit(['clean', '-df'])
await this.execGit(['checkout', '.'])
// Since only staged files are now present, get a diff of unstaged changes
// by comparing current index against original stash, but in reverse
Expand Down

0 comments on commit e58ebbf

Please sign in to comment.