FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Automatically free repositories post clone by tbranyen · Pull Request #434 · nodegit/nodegit · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 15 additions & 1 deletion lib/clone.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,21 @@ Clone.clone = function(url, local_path, options) {
normalizeOptions(remoteCallbacks, NodeGit.RemoteCallbacks);
}

return clone.call(this, url, local_path, options);
// This is required to clean up after the clone to avoid file locking
// issues in Windows and potentially other issues we don't know about.
var freeRepository = function(repository) {
repository.free();
};

// We want to provide a valid repository object, so reopen the repository
// after clone and cleanup.
var openRepository = function() {
return NodeGit.Repository.open(local_path);
};

return clone.call(this, url, local_path, options)
.then(freeRepository)
.then(openRepository);
};

module.exports = Clone;
8 changes: 0 additions & 8 deletions test/runner.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ beforeEach(function() {
});

afterEach(function(done) {
// In Windows if you do not clean up the repository, there may become a
// conflict with file locking.
if (this.repository && process.platform === "win32") {
this.repository.stateCleanup();
this.repository.free();
delete this.repository;
}

process.nextTick(function() {
global.gc();
done();
Expand Down
15 changes: 0 additions & 15 deletions test/tests/clone.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ describe("Clone", function() {
// Set a reasonable timeout here now that our repository has grown.
this.timeout(30000);

beforeEach(function(done) {
// In Windows if you do not clean up the repository, there may become a
// conflict with file locking.
if (this.repository && process.platform === "win32") {
this.repository.stateCleanup();
this.repository.free();
delete this.repository;
}

process.nextTick(function() {
global.gc();
done();
});
});

beforeEach(function() {
return fse.remove(clonePath).catch(function(err) {
console.log(err);
Expand Down

Back | FazBrowse Home | New Git URL