Skip to content

Commit a5fa89c

Browse files
committed
Make the message argument of Stash.save optional
libgit2's git_stash_save function does not actually require the message to be set. One will be generated if a message is not given so the parameter should be flagged as being optional in NodeGit as well.
1 parent 3e06530 commit a5fa89c

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

generate/input/descriptor.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,11 @@
21752175
}
21762176
},
21772177
"git_stash_save": {
2178+
"args": {
2179+
"message": {
2180+
"isOptional": true
2181+
}
2182+
},
21782183
"isAsync": true,
21792184
"return": {
21802185
"isErrorCode": true

test/tests/stash.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ describe("Stash", function() {
3131
});
3232
});
3333

34-
it("can save and drop a stash", function() {
34+
function saveDropStash(repo, stashMessage) {
3535
var fileName = "README.md";
3636
var fileContent = "Cha-cha-cha-chaaaaaangessssss";
37-
var repo = this.repository;
3837
var filePath = path.join(repo.workdir(), fileName);
3938
var oldContent;
4039
var stashes = [];
4140
var stashOid;
42-
var stashMessage = "stash test";
4341

4442
return fse.readFile(filePath)
4543
.then(function(content) {
@@ -82,6 +80,14 @@ describe("Stash", function() {
8280
return Promise.reject(e);
8381
});
8482
});
83+
}
84+
85+
it("can save and drop a stash", function() {
86+
saveDropStash(this.repository, "stash test");
87+
});
88+
89+
it("can save a stash with no message and drop it", function() {
90+
saveDropStash(this.repository, null);
8591
});
8692

8793
it("can save and pop a stash", function() {

0 commit comments

Comments
 (0)