Skip to content

Commit 364d548

Browse files
committed
don't support discarding staged lines
1 parent e80e6d4 commit 364d548

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Diff for: lib/repository.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1550,18 +1550,16 @@ Repository.prototype.stageLines =
15501550
};
15511551

15521552
/**
1553-
* Discard line selection of a specified file
1553+
* Discard line selection of a specified file.
1554+
* Assumes selected lines are unstaged.
15541555
*
15551556
* @async
15561557
* @param {String} filePath The relative path of this file in the repo
15571558
* @param {Array} selectedLines The array of DiffLine objects
15581559
* selected for discarding
1559-
* @param {Boolean} isStaged Are the selected lines currently staged
15601560
* @return {Number} 0 or an error code
15611561
*/
1562-
Repository.prototype.discardLines =
1563-
function(filePath, selectedLines, isSelectionStaged) {
1564-
1562+
Repository.prototype.discardLines = function(filePath, selectedLines) {
15651563
var repo = this;
15661564
var fullFilePath = path.join(repo.workdir(), filePath);
15671565
var index;
@@ -1576,11 +1574,11 @@ Repository.prototype.discardLines =
15761574
.then(function(content) {
15771575
originalContent = content;
15781576

1579-
return getPathHunks(repo, index, filePath, isSelectionStaged);
1577+
return getPathHunks(repo, index, filePath, false);
15801578
})
15811579
.then(function(hunks) {
15821580
return applySelectedLinesToTarget(
1583-
originalContent, selectedLines, hunks, isSelectionStaged, true
1581+
originalContent, selectedLines, hunks, false, true
15841582
);
15851583
})
15861584
.then(function(newContent) {

0 commit comments

Comments
 (0)