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

Creating a new branch #828

Closed
simonwhite71 opened this issue Nov 19, 2020 · 5 comments · Fixed by #829
Closed

Creating a new branch #828

simonwhite71 opened this issue Nov 19, 2020 · 5 comments · Fixed by #829
Labels

Comments

@simonwhite71
Copy link

simonwhite71 commented Nov 19, 2020

If I try and make a new branch called "test" with the UI it says
ambiguous argument 'test': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'
Which is the same error I see if on the command line I run
git diff test
rather than
git checkout -b test
Am I doing something wrong?

Also if in the UI I try to make a branch with name -b test I get the error message
usage: git diff [<options>] [<commit> [<commit>]] [--] [<path>...]

@ianhi
Copy link
Collaborator

ianhi commented Nov 19, 2020

Hey @simonwhite71 thanks for the report. You aren't doing anything wrong, this looks like a bug that was introduced by #824

In that PR we started checking for what files will be changed by the git action before we switch branches. But that breaks down if we are opening a new branch. The relevant lines are these:

jupyterlab-git/src/model.ts

Lines 385 to 405 in 1a57cab

async () => {
let changes;
if (body.checkout_branch) {
changes = await this._changedFiles(
this._currentBranch.name,
body.branchname
);
} else if (body.filename) {
changes = { files: [body.filename] };
} else {
changes = await this._changedFiles('WORKING', 'HEAD');
}
const d = await requestAPI<Git.ICheckoutResult>(
'checkout',
'POST',
body
);
changes.files?.forEach(file => this._revertFile(file));
return d;

@ianhi
Copy link
Collaborator

ianhi commented Nov 19, 2020

Also, great job tracking down that it was a git diff error. The reason git diff is called when checking out a branches is so that we can keep track of what files are being touched by the git action to make sure that if they are open in an editor then the editor is kept up to date with the version on disk.

@simonwhite71
Copy link
Author

Oh good, glad I could help, any idea when it might be resolved (not an issue for now, we can always branch manually)

@ianhi
Copy link
Collaborator

ianhi commented Nov 19, 2020

Fix is here: #829

So waiting on review of that - then we can do a patch release. You can also downgrade to 0.22.x or maybe even 0.23.0

@simonwhite71
Copy link
Author

Thats great, thanks for being so responsive, I will wait for the next patch release 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants