this post was submitted on 20 Nov 2024
857 points (97.5% liked)

Programmer Humor

19821 readers
935 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
857
submitted 1 month ago* (last edited 1 month ago) by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 141 points 1 month ago (4 children)

I feel bad for this kid. That really is a bad warning dialog. Nowhere does it say it's going to delete files. Anyone who thinks that's good design needs a break.

Half the replies are basically "This should be obvious if your past five years of life experience is similar to mine, and if it isn't then get fucked." Just adding insult to injury.

[–] [email protected] 69 points 1 month ago (3 children)

I'm not great at English, but "discard all changes" shouldn't ever mean "Delete".

[–] [email protected] 30 points 1 month ago (3 children)

In the context of version control it does. Discarding a change that creates a file means deleting the file.

[–] [email protected] 15 points 1 month ago

If you have set up your staging area for a commit you may want to discard (unstage) changes from the staging area, as opposed to discarding changes in the working directory.

Of course, the difference between the two is obvious if you're using git CLI, but I can easily see someone using a GUI (and that maybe isn't too familiar with git) misunderstanding "discard" as "unstage".

Either way, what happened here indicates that all the files were somehow added to the VC, without having been committed first, or something like that, because git will not let you discard a file that is untracked, because that wouldn't make any sense. The fact that the GUI let this person delete a bunch of files without first committing them to the index is what makes this a terrible design choice, and also what makes the use of the word "discard" misleading.

[–] [email protected] 3 points 1 month ago

"Discard" is not a git operation.

[–] [email protected] 2 points 1 month ago (1 children)

Ok fair enough, but I'm under the impression these files existed before the source control was implemented.

I guess it's all up to how the program handles existing files.

[–] [email protected] 3 points 1 month ago

I guess the newly created git repository was empty, and all the files that was present in the folder represented "changes"

[–] [email protected] 5 points 1 month ago (2 children)

I'm pretty sure vscode shows a confirmation dialog when discarding changes will permanently delete a file. I've done that recently with temporary files that were no longer needed.

[–] [email protected] 9 points 1 month ago

I remember following the drama back in the day. That warning you saw was the result of this now-classic bug report.

[–] [email protected] 1 points 1 month ago

Did you even read the thread?

[–] [email protected] 2 points 1 month ago

the alternative to deleting is emptying the file contents, which is essentially the same...

[–] [email protected] 41 points 1 month ago (2 children)

Also, why not send them to the recycle bin? I never really thought about it before, but that does seem a reasonable UX improvement for this case

[–] [email protected] 3 points 1 month ago

I wonder if there's already a git extension to automatically stash the working tree on every clean/reset/checkout operation...

[–] [email protected] 3 points 1 month ago (1 children)

Because “the underlying Git nukes them right away, so why shouldn’t we perma-delete the files, too?”

Anything else’d be effort…

[–] [email protected] 8 points 1 month ago (1 children)

Honestly it probably just runs the underlying git command

[–] [email protected] 1 points 1 month ago

Sorta, but sorta no.

It was actually addressed in https://github.com/microsoft/vscode/issues/32459 – the GUI implied a different git command than what actually got executed!

[–] [email protected] 4 points 1 month ago

It's so fucking infuriating that so many devs act like this. "This should've been obvious!" Fuck off, that's an unhelpful statement. "You should've been using version control! No backup, no sympathy!" Fuck off, they were literally trying to begin using version control for backups.

Even half the comments on this very Lemmy thread are disparaging this dev. I wonder how many actually read the thread and found that there was a bug discovered causing this feature to delete files not even associated with git?

But, congratulations to them, I suppose. Congratulations on making fun of someone. I hope it makes them feel powerful. 🙄 Devs can be so toxic.

[–] [email protected] 4 points 1 month ago

Came here to say this. No one deserves this, not even new programmers who try to learn things.

Some programming tools are really powerful compared to what new users are used to. If you come from the world of Microsoft Office and Apple whatever it's called, everything is saved automatically to cloud and there is some local backup file somewhere which you can just restore. Modern programs are designed to protect users against their own mistakes, and when suddenly that is taken away, it can be a jarring experience.