summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1cac41f)
raw | patch | inline | side by side (parent: 1cac41f)
author | Heiko Voigt <hvoigt@hvoigt.net> | |
Tue, 15 Feb 2011 19:43:54 +0000 (19:43 +0000) | ||
committer | Pat Thoyts <patthoyts@users.sourceforge.net> | |
Fri, 20 May 2011 21:49:15 +0000 (22:49 +0100) |
The commandline is already warning when checking out a detached head.
Since the only thing thats potentially dangerous is to create commits
on a detached head lets warn in case the user is about to do that.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Since the only thing thats potentially dangerous is to create commits
on a detached head lets warn in case the user is about to do that.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
git-gui.sh | patch | blob | history | |
lib/commit.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index fd6a43d0a29986d38094df2818b66beba0f49234..470b13528544a0c6350150e38f25c889d76764e5 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
# TODO: this option should be added to the git-config documentation
set default_config(gui.maxfilesdisplayed) 5000
set default_config(gui.usettk) 1
+set default_config(gui.warndetachedcommit) 1
set font_descs {
{fontui font_ui {mc "Main Font"}}
{fontdiff font_diff {mc "Diff/Console Font"}}
diff --git a/lib/commit.tcl b/lib/commit.tcl
index 5ce46877bfb24701187f5ff5e94ce4aaf8b666b2..372bed9948390483d66036231fce2fe8964d7bb6 100644 (file)
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
}
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]