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
Git Discard All Changes fails with "ENAMETOOLONG" #65693
Comments
It's because vscode runs this command on clicking "Discard all changes":
|
It seems like it's actually a shortcoming of git itself. |
I have reproed this locally. In my test repo, I can see that discarding 2001 modified files creates a command line which is 78949 characters long, but the windows limit is 32767, assuming node is calling CreateProcess under the covers, and based on the info provided here: https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553/. The problem is, the UI for discard all changes, in commands.ts:cleanAll, is translating the cleanAll into a repository.ts:clean with a list of all of the modified files. The repository itself doesn't know that this list of resources is all of the changes in the repository. Furthermore, this issue doesn't affect only discard all changes. I was able to select the top change, and scroll down then shift click to select a subset of all of the changes, then right click, and select discard to see the same ENAMETOOLONG error message. Simply replacing Looking in the code at repository.ts:clean, I suspect a similar issue may occur with git.ts:clean, and it may occur with other repository types, other that git, if they do anything similar in terms of concatenating the list of resources. Two possible options for a fix:
Fixing in respository.ts means that any SCS underneath will benefit from being called with a list of files of a reasonable length. The maximum allowable length will vary from system to system, with Windows having a much smaller maximum allowable size than others.
|
Still, if this would solve the problem, I'd take it. I forgot why we had to list all files explicitly, but I'm assuming we'll remember as soon as we give it a try. We have to experiment with it. |
But it won't fix the problem. As I mentioned, if I select a long subset of changes, not all, it still goes through the same code path and gives the same error. If |
That's correct... Perhaps some sort of batching needs to be implemented to handle these type of cases? |
The underlying issue is not specific to Discard All nor is it even specific to Discard in general. This affects any git command that has the potential of containing a long list of files -- if you select a large number of modified/added files and Stage/Unstage them, for example. The problem is as @rcbevans stated: the command ends up being too long because it's just a concatenated list of files. It looks like some commands (like |
I get the same issue. Is there any temporary solution to resolve that? |
@joaomoreno is this fixed in a commit? or did you close it by mistake? or is there some other plan to tackle this? |
Is this released in the latest version of VSCode. I don't know by looking at #66095 |
@rsaritzky As far as I can tell, it is. The PR was merged and some changes were made to clean it up and reorganize some things. The changes seem to be there in the 1.38.1 tag. Of course, the best way to verify is to try a command that used to fail and see if it works in the latest version. |
Hi,
I am a relatively new VSCode user, but as far as I can tell I am on the latest version of VSCode – An update ran this morning. The “Git Discard all changes” command still fails with ENAMETOOLONG if there are more than about 400 files:
[cid:image001.png@01D56978.DCC72B90]
From: Herohtar <notifications@github.com>
Sent: Thursday, September 12, 2019 12:29 PM
To: microsoft/vscode <vscode@noreply.github.com>
Cc: Ron Saritzky <rons@cryobank.com>; Mention <mention@noreply.github.com>
Subject: Re: [microsoft/vscode] Git Discard All Changes fails with "ENAMETOOLONG" (#65693)
@rsaritzky<https://github.com/rsaritzky> As far as I can tell, it is. The PR was merged and some changes were made to clean it up and reorganize some things. Of course, the best test is to try a command that used to fail and see if it works in the latest version.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#65693?email_source=notifications&email_token=AMBA5Y26XF4POTZ4BKQD2E3QJKJ7LA5CNFSM4GMHGOYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6S7OHI#issuecomment-530970397>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMBA5Y3CQTQOZCQLYBIF2ILQJKJ7LANCNFSM4GMHGOYA>.
|
@rsaritzky Go to Help -> About in VS Code and check which version you are running. I just tested on my installation which is running 1.38.0 and was able to do a Discard All with 1,130 modified files. |
I sent you a screenshot of my Help/About – it is 1.38.1. The error occurs under certain circumstances. I will try to replicate it and give you exact conditions. We use a source code management addon for our Microsoft Dynamics NAV development and it generates the files, so I have to determine the exact circumstance. I will send the output of the command as well.
Thank you for the reply.
Ron Saritzky
From: Herohtar <notifications@github.com>
Sent: Thursday, September 12, 2019 3:02 PM
To: microsoft/vscode <vscode@noreply.github.com>
Cc: Ron Saritzky <rons@cryobank.com>; Mention <mention@noreply.github.com>
Subject: Re: [microsoft/vscode] Git Discard All Changes fails with "ENAMETOOLONG" (#65693)
@rsaritzky<https://github.com/rsaritzky> Go to Help -> About in VS Code and check which version you are running. I just tested on my installation which is running 1.38.0 and was able to do a Discard All with 1,130 modified files.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#65693?email_source=notifications&email_token=AMBA5Y5P2RQHCF7BV2FFFBTQJK333A5CNFSM4GMHGOYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6TMMWI#issuecomment-531023449>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMBA5YYY6K2UW4FZFQ2EWTTQJK333ANCNFSM4GMHGOYA>.
|
Steps to Reproduce:
Reported earlier at #23943, but the issue was closed.
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: