Re: [PATCH 0/1] Allow the 'revert' option in Git Gui to operate on untracked files, deleting them
From: Jonathan Gilbert <hidden>
Date: 2019-10-29 20:34:12
(should have had:)
quoted
I have an entry in the "Tools" menu for this called 'Delete':
That's kind of neat, I wasn't aware of that facet of Git Gui :-) But, it isn't quite the same feature:
Oops, double gaffe. I accidentally forgot to "Reply All", so this was a re-send of the message. And when I re-sent it, I didn't notice that the e-mail client hid the quoted line from me and accidentally sent it without quoting Bert's line. I wasn't sure whether to write this follow-up but the longer I stared at it, the more sure I was that somebody would call me out on it so I decided to be pre-emptive. My apologies if it would have been better to just let it slide. Jonathan Gilbert On Tue, Oct 29, 2019 at 3:25 PM Jonathan Gilbert [off-list ref] wrote:
That's kind of neat, I wasn't aware of that facet of Git Gui :-) But, it isn't quite the same feature: * It has to be manually set up on each installation. * It invokes an external process, I don't know if it's safe to assume that "rm" will work on all platforms (though I just tested it on my Windows installation and it worked). * It doesn't remove directories that it makes empty. * I don't see a way to bind it to a keyboard shortcut. That could just be me not knowing enough about custom tools, though. :-) * It only processes the first file selected. * If I select a tracked file, it will still delete it, and the feature I'm looking for is more of a "return repository to clean state" type function, like "revert" already is but extended to handle files that you can't actually "git revert". Thanks, Jonathan Gilbert On Tue, Oct 29, 2019 at 9:32 AM Bert Wesarg bert.wesarg-at-googlemail.com |GitHub Public/Example Allow| [off-list ref] wrote:quoted
On Mon, Oct 28, 2019 at 7:58 PM Jonathan Gilbert via GitGitGadget [off-list ref] wrote:quoted
My development environment sometimes makes automatic changes that I don't want to keep. In some cases, this involves new files being added that I don't want to commit or keep. I have typically had to explicitly delete those files externally to Git Gui, and I want to be able to just select those newly-created untracked files and "revert" them into oblivion.I have an entry in the 'Tools" menu for this called 'Delete': [guitool "Delete"] cmd = rm -f \"$FILENAME\" noconsole = yes needsfile = yes confirm = yes Best, Bertquoted
This change updates the revert_helper function to check for untracked files as well as changes, and then any changes to be reverted and untracked files are handled by independent blocks of code. The user is prompted independently for untracked files, since the underlying action is fundamentally different (rm -f). If after deleting untracked files, the directory containing them becomes empty, then the directory is removed as well. This introduces new strings in index.tcl. I have been told that there is a separate process whereby the translations get updated. Jonathan Gilbert (1): git-gui: Revert untracked files by deleting them git-gui/lib/index.tcl | 139 +++++++++++++++++++++++++++++++----------- 1 file changed, 104 insertions(+), 35 deletions(-)