From patchwork Thu Aug 22 22:01:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Yadav X-Patchwork-Id: 11110165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59F2613B1 for ; Thu, 22 Aug 2019 22:01:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37D5A233FC for ; Thu, 22 Aug 2019 22:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404836AbfHVWBV (ORCPT ); Thu, 22 Aug 2019 18:01:21 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:43627 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404199AbfHVWBT (ORCPT ); Thu, 22 Aug 2019 18:01:19 -0400 Received: from localhost.localdomain (unknown [1.186.12.26]) (Authenticated sender: me@yadavpratyush.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 611BA240008; Thu, 22 Aug 2019 22:01:16 +0000 (UTC) From: Pratyush Yadav To: Cc: Pratyush Yadav , Junio C Hamano , Johannes Sixt , Bert Wesarg Subject: [PATCH v2 2/4] git-gui: Add option to disable the revert confirmation prompt Date: Fri, 23 Aug 2019 03:31:05 +0530 Message-Id: <20190822220107.4153-3-me@yadavpratyush.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190822220107.4153-1-me@yadavpratyush.com> References: <20190819214110.26461-1-me@yadavpratyush.com> <20190822220107.4153-1-me@yadavpratyush.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When reverting files (or hunks or lines that future commits will add), a confirmation dialog is shown to make sure the user actually wanted to revert, and did not accidentally click revert. But for some people's workflow this is an hindrance. So add an option to disable this behaviour for people who are comfortable risking accidental reverts. The default behaviour is to ask for confirmation. Signed-off-by: Pratyush Yadav --- git-gui.sh | 1 + lib/index.tcl | 22 +++++++++++++--------- lib/option.tcl | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 5bc21b8..b7811d8 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -903,6 +903,7 @@ set font_descs { } set default_config(gui.stageuntracked) ask set default_config(gui.displayuntracked) true +set default_config(gui.revertaskconfirmation) true ###################################################################### ## diff --git a/lib/index.tcl b/lib/index.tcl index cb7f74a..dd694d1 100644 --- a/lib/index.tcl +++ b/lib/index.tcl @@ -389,15 +389,19 @@ proc do_add_all {} { } proc revert_dialog {query} { - return [tk_dialog \ - .confirm_revert \ - "[appname] ([reponame])" \ - "$query" \ - question \ - 1 \ - [mc "Do Nothing"] \ - [mc "Revert Changes"] \ - ] + if {[is_config_true gui.revertaskconfirmation]} { + return [tk_dialog \ + .confirm_revert \ + "[appname] ([reponame])" \ + "$query" \ + question \ + 1 \ + [mc "Do Nothing"] \ + [mc "Revert Changes"] \ + ] + } else { + return 1 + } } proc revert_helper {txt paths} { diff --git a/lib/option.tcl b/lib/option.tcl index e43971b..cb62d5d 100644 --- a/lib/option.tcl +++ b/lib/option.tcl @@ -162,6 +162,7 @@ proc do_options {} { {s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}} {b gui.displayuntracked {mc "Show untracked files"}} {i-1..99 gui.tabsize {mc "Tab spacing"}} + {b gui.revertaskconfirmation {mc "Ask for confirmation when reverting changes"}} } { set type [lindex $option 0] set name [lindex $option 1]