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

Identical expressions on both sides of || in git-quick-open-service#doBuildDefaultProjectPath #11900

Open
JonasHelming opened this issue Nov 21, 2022 · 6 comments
Assignees

Comments

@JonasHelming
Copy link
Contributor

Blocked for hackathon

See:

let projectPath = folderPath + '/' + (uriSplitted.pop() || uriSplitted.pop());

The same expression is used on both sides of a || operator, which is very confusing.

@tsmaeder : Do you want to add details and test instructions for this one?

  • Operating System: latet
  • Theia Version: latest
@JonasHelming JonasHelming added the hackathon issues reserved for hackatons label Nov 21, 2022
@tsmaeder
Copy link
Contributor

@JonasHelming is there an actual observable problem behind this or is it just a code smell?

@JonasHelming
Copy link
Contributor Author

@tsmaeder I did not investigate this in detail. "At least" a code smell, maybe an issue.

@tsmaeder
Copy link
Contributor

tsmaeder commented Dec 13, 2022

This code is actually correct, but misleading: let's look at what split gives for the following string:

'foo/bar/zoz/'.split('/') = ['foo', 'bar', 'zoz', ""]

so if you evalutate uriSplitted.pop(), you'll get back '', which evalutes to false, so then the code invokes uriSplitted.pop() again, which this time evaluates to 'zoz'. Basically, it gets back the last non-emtpy element of the path.

@tsmaeder
Copy link
Contributor

the "Git: clone" command is 100% broken: seems our quick pick implementation does not invoke the "execute" function in this case: since there is no "selected item", only a value in this case. Not usefule for Hackathon.

@JonasHelming
Copy link
Contributor Author

@tsmaeder : Could you remove the label then or close the bug and search/create another one for you for the Hackathon, please

@tsmaeder tsmaeder removed the hackathon issues reserved for hackatons label Dec 13, 2022
@tsmaeder
Copy link
Contributor

Probably the code is still wrong when someone enters a uri like "https://github.com/my/repo///", but we can't verify it right now.

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

No branches or pull requests

2 participants