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

Terminal run Git command can be "corrupted" if there is previous text waiting in the terminal #2664

Open
fterradev opened this issue May 8, 2023 · 11 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@fterradev
Copy link

Description

On a macOS Monterey (12.6.3)

  1. Right-click a commit in the commits panel
  2. Select option "Reset Current Branch to Commit..."
  3. Select option "Hard Reset"

Expect result:
The reset command works and the branch gets reset to the selected commit.

Actual result:
The reset command fails.

% git checkoutgit -C "/Users/johndoe/my-app" -c "core.editor=code --wait --reuse-window" reset --hard 9899d3cbb666bdb4e588cec6372f52b83bcfe656
git: 'checkoutgit' is not a git command. See 'git --help'.

Workaround: removing keyword 'checkoutgit' from the command seems to fix the issue.

GitLens Version

13.5.0

VS Code Version

Version: 1.78.0 (Universal)
Commit: 252e5463d60e63238250799aef7375787f68b4ee
Date: 2023-05-03T20:11:00.813Z
Electron: 22.4.8
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: No

Git Version

git version 2.37.1 (Apple Git-137.1)

Logs, Screenshots, Screen Captures, etc

No response

@fterradev fterradev added bug Something isn't working triage Needs to be looked at labels May 8, 2023
@fterradev fterradev changed the title error: git: 'checkoutgit' is not a git command. "Reset Current Branch to Commit..." fails with error: git: 'checkoutgit' is not a git command. May 8, 2023
@eamodio eamodio self-assigned this May 8, 2023
@eamodio eamodio removed the triage Needs to be looked at label May 8, 2023
@eamodio eamodio closed this as completed in 482c173 May 8, 2023
@eamodio eamodio added pending-release Resolved but not yet released to the stable edition needs-verification Request for verification labels May 8, 2023
@eamodio eamodio changed the title "Reset Current Branch to Commit..." fails with error: git: 'checkoutgit' is not a git command. Terminal run Git command can be "corrupted" if there is previous text waiting in the terminal May 8, 2023
@eamodio
Copy link
Member

eamodio commented May 8, 2023

@fterradev The issue here was that it looks like you typed "git checkout" in the GitLens terminal (but never hit enter), and then want GL executed the reset command, it tacked it on to the existing "git checkout" text.

GitLens will now remove/overwrite any existing input text in the terminal.

@eamodio
Copy link
Member

eamodio commented May 8, 2023

Can you please verify this fix in tomorrow's (v2023.5.09xx) pre-release edition of GitLens? Thank you so much!

You can switch to the pre-release edition of GitLens, by clicking on the "Switch to Pre-Release version of this extension" from the Extensions view.

image

@fterradev
Copy link
Author

Oh, ok, I didn't realized it. Yes, I just reproduced it by typing something in the terminal. Thanks!
Didn't test the new version yet.

@fterradev
Copy link
Author

Can you please verify this fix in tomorrow's (v2023.5.09xx) pre-release edition of GitLens? Thank you so much!

You can switch to the pre-release edition of GitLens, by clicking on the "Switch to Pre-Release version of this extension" from the Extensions view.

image

Hey, I tested it didn't work...
Actually there seems to be a new defect.

It seems like the git command is now instead called as usr/bin/git. And I get something similar to this:

% usr/bin/git -C "/Users/johndoe/my-app" -c "core.editor=code --wait --reuse-window" reset --hard 9899d3cbb666bdb4e588cec6372f52b83bcfe656
zsh: no such file or directory: usr/bin/git

@fterradev
Copy link
Author

fterradev commented May 9, 2023

And also if I have something typed in before like "foo", I get an error similar to the original one:

zsh: no such file or directory: foousr/bin/git

(Note "foo" is still there)

Even though I see those added codes to supposedly remove any text on the current line in the terminal when I first use GitLens and there was no GitLens terminal opened yet.

image

But it also fail due to having that prefix "usr/bin/" as I said in the previous message.

zsh: no such file or directory: usr/bin/git

@eamodio eamodio removed pending-release Resolved but not yet released to the stable edition needs-verification Request for verification labels May 11, 2023
@eamodio eamodio reopened this May 11, 2023
@eamodio
Copy link
Member

eamodio commented May 11, 2023

Unfortunately I can't find a solution that works across OSs and across shells.

@eamodio eamodio added this to the Backlog milestone May 11, 2023
@farmerpaul
Copy link

This same issue started biting me yesterday, experiencing the exact same behaviour as @fterradev. Not sure I understand why usr/bin/git is no longer preceded by a / as of the last GitLens update, but I can't really use any of its commands anymore for this reason (unless someone knows a workaround?). Thanks for investigating!

@eamodio
Copy link
Member

eamodio commented May 11, 2023

Are you still seeing this in the latest pre-release? I thought I fixed this last night.

@farmerpaul
Copy link

Good call, my extension hadn't updated 🤦🏻 . Tested this morning, it's working again! Thanks!

@fterradev
Copy link
Author

@eamodio Never mind. I consider it was mostly an error of mine as a user.

Aside from that, I don't know if it was intentional to move from using simply the git command, to have now the full path to the binary.
Anyway it's working fine.

@fterradev fterradev reopened this May 15, 2023
@fterradev
Copy link
Author

I don't know if you want to close as completed or close as not planned. I'll defer to you. Thanks for the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants