X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=git-gui%2Flib%2Fcommit.tcl;h=372bed9948390483d66036231fce2fe8964d7bb6;hb=1ad4b17b069a7b692ab801bda37c5ab35ef0208e;hp=5ce46877bfb24701187f5ff5e94ce4aaf8b666b2;hpb=e63f87a6f7a4e55f50e67b112f26d9a1e4e7f3ab;p=git.git diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl index 5ce46877b..372bed994 100644 --- a/git-gui/lib/commit.tcl +++ b/git-gui/lib/commit.tcl @@ -260,8 +260,23 @@ proc commit_prehook_wait {fd_ph curHEAD msg_p} { } proc commit_commitmsg {curHEAD msg_p} { + global is_detached repo_config global pch_error + if {$is_detached && $repo_config(gui.warndetachedcommit)} { + set msg [mc "You are about to commit on a detached head.\ +This is a potentially dangerous thing to do because if you switch\ +to another branch you will loose your changes and it can be difficult\ +to retrieve them later from the reflog. You should probably cancel this\ +commit and create a new branch to continue.\n\ +\n\ +Do you really want to proceed with your Commit?"] + if {[ask_popup $msg] ne yes} { + unlock_index + return + } + } + # -- Run the commit-msg hook. # set fd_ph [githook_read commit-msg $msg_p]