Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused imports, make clicktests more reliable, fix git rev-parse with bare repositories, fix crash when directory gets deleted #1263

Merged
merged 7 commits into from
Jan 24, 2020

Conversation

campersau
Copy link
Collaborator

@campersau campersau commented Jan 21, 2020

(also want to check timeouts in appveyor builds)

fixes #1265
fixes #1266

@campersau
Copy link
Collaborator Author

It looks like git version 2.25 changed the behavior of git rev-parse --show-toplevel inside of bare repositories. It now throws an error: fatal: this operation must be run in a work tree

That's the reason why travis with the latest git version and all appveyor builds are failing. Appveyor updated the git version a few days ago.

});
app.post(`${exports.pathPrefix}/testing/shutdown`, ensureAuthenticated, (req, res) => {
res.json({});
process.exit();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exiting the process during a request / response can result in connection reset errors on the client which can make tests fail.

app.post(`${exports.pathPrefix}/testing/shutdown`, ensureAuthenticated, (req, res) => {
res.json({});
process.exit();
app.post(`${exports.pathPrefix}/testing/cleanup`, (req, res) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed ensureAuthenticated from this endpoint so it can be called during the AUTHENTICATION clicktests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these endpoints still available when running ungit outside of tests?
If it doesn't require authentication, should it be hidden behind a TEST env variable for example?

Copy link
Collaborator Author

@campersau campersau Jan 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are hidden behind the dev config (and only the testing/cleanup endpoint is affected by this change).

if (config.dev) {

ungit/source/config.js

Lines 65 to 66 in 68d69bb

// Used for development purposes.
dev: false,

if (!doNotClose) {
return this.nm.end();
if (this.ungitServer) {
this.ungitServer.kill('SIGINT');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of exiting the process from inside, the child process gets killed from the outside. (See above for reasons.)

@@ -80,7 +81,11 @@ exports.registerApi = (env) => {
emitGitDirectoryChanged(socket.watcherPath);
emitWorkingTreeChanged(socket.watcherPath);
}
}));
});
watcher.on('error', (err) => {
Copy link
Collaborator Author

@campersau campersau Jan 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listening for watcher errors is required otherwise the ungit process crashes when errors occur.

Steps to reproduce (on windows at least I got a permission error):

  • initialize a new git repro in some folder
  • navigate to some folder in ungit
  • remove some folder

@campersau campersau changed the title remove unused imports remove unused imports, make clicktests more reliable, fix git rev-parse with bare repositories, fix crash when directory gets deleted Jan 21, 2020
@campersau campersau merged commit fd2980c into FredrikNoren:master Jan 24, 2020
@campersau campersau deleted the unused_imports branch January 24, 2020 21:47
This was referenced Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ungit crashes if current directory is deleted Bare repositories don't work with git 2.25
2 participants