{"thread":{"id":"28749","subject":"[PATCH 2/2] git-gui: don't warn for detached head when rebasing","startedAt":"2011-10-22T19:39:39Z","lastAt":"2011-11-05T00:48:26Z","messageCount":4,"participants":["Bert Wesarg","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"178183","messageId":"0f4995b5df707782c73ec83171fb2f512ae887ef.1319312280.git.bert.wesarg@googlemail.com","threadId":"28749","inReplyTo":null,"subject":"[PATCH 1/2] git-gui: make config gui.warndetachedcommit a boolean","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-22T19:39:39Z","receivedAt":"2011-10-22T19:39:39Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/commit.tcl |    2 +-\n lib/option.tcl |    1 +\n 2 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex 372bed9..e27e148 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -263,7 +263,7 @@ proc commit_commitmsg {curHEAD msg_p} {\n \tglobal is_detached repo_config\n \tglobal pch_error\n \n-\tif {$is_detached && $repo_config(gui.warndetachedcommit)} {\n+\tif {$is_detached && [is_config_true gui.warndetachedcommit]} {\n \t\tset msg [mc \"You are about to commit on a detached head.\\\n This is a potentially dangerous thing to do because if you switch\\\n to another branch you will loose your changes and it can be difficult\\\ndiff --git a/lib/option.tcl b/lib/option.tcl\nindex 719103a..f7f866b 100644\n--- a/lib/option.tcl\n+++ b/lib/option.tcl\n@@ -156,6 +156,7 @@ proc do_options {} {\n \t\t{i-0..99 gui.commitmsgwidth {mc \"Commit Message Text Width\"}}\n \t\t{t gui.newbranchtemplate {mc \"New Branch Name Template\"}}\n \t\t{c gui.encoding {mc \"Default File Contents Encoding\"}}\n+\t\t{b gui.warndetachedcommit {mc \"Warn before commiting to a detached head\"}}\n \t\t{s gui.stageuntracked {mc \"Staging of untracked files\"} {list \"yes\" \"no\" \"ask\"}}\n \t\t} {\n \t\tset type [lindex $option 0]\n-- \n1.7.7.908.g383b5\n"},{"id":"178182","messageId":"a9a6eb9e70a8d4a75f2061a51bf401469d1b0b7f.1319312280.git.bert.wesarg@googlemail.com","threadId":"28749","inReplyTo":"0f4995b5df707782c73ec83171fb2f512ae887ef.1319312280.git.bert.wesarg@googlemail.com","subject":"[PATCH 2/2] git-gui: don't warn for detached head when rebasing","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-22T19:39:40Z","receivedAt":"2011-10-22T19:39:40Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/commit.tcl |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex e27e148..d679db4 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -263,7 +263,9 @@ proc commit_commitmsg {curHEAD msg_p} {\n \tglobal is_detached repo_config\n \tglobal pch_error\n \n-\tif {$is_detached && [is_config_true gui.warndetachedcommit]} {\n+\tif {$is_detached\n+\t    && ![file exists [gitdir [file join rebase-merge head-name]]]\n+\t    && \t[is_config_true gui.warndetachedcommit]} {\n \t\tset msg [mc \"You are about to commit on a detached head.\\\n This is a potentially dangerous thing to do because if you switch\\\n to another branch you will loose your changes and it can be difficult\\\n-- \n1.7.7.908.g383b5\n"},{"id":"178766","messageId":"CAKPyHN24RwNjJanaMQ0AjXc2iorFw=taCmcS-iuNt0vQ46_TOg@mail.gmail.com","threadId":"28749","inReplyTo":"0f4995b5df707782c73ec83171fb2f512ae887ef.1319312280.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH 1/2] git-gui: make config gui.warndetachedcommit a boolean","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-11-03T11:27:34Z","receivedAt":"2011-11-03T11:27:34Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Sat, Oct 22, 2011 at 21:39, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> ---\n>  lib/commit.tcl |    2 +-\n>  lib/option.tcl |    1 +\n>  2 files changed, 2 insertions(+), 1 deletions(-)\n>\n> diff --git a/lib/commit.tcl b/lib/commit.tcl\n> index 372bed9..e27e148 100644\n> --- a/lib/commit.tcl\n> +++ b/lib/commit.tcl\n> @@ -263,7 +263,7 @@ proc commit_commitmsg {curHEAD msg_p} {\n>        global is_detached repo_config\n>        global pch_error\n>\n> -       if {$is_detached && $repo_config(gui.warndetachedcommit)} {\n> +       if {$is_detached && [is_config_true gui.warndetachedcommit]} {\n>                set msg [mc \"You are about to commit on a detached head.\\\n>  This is a potentially dangerous thing to do because if you switch\\\n>  to another branch you will loose your changes and it can be difficult\\\n> diff --git a/lib/option.tcl b/lib/option.tcl\n> index 719103a..f7f866b 100644\n> --- a/lib/option.tcl\n> +++ b/lib/option.tcl\n> @@ -156,6 +156,7 @@ proc do_options {} {\n>                {i-0..99 gui.commitmsgwidth {mc \"Commit Message Text Width\"}}\n>                {t gui.newbranchtemplate {mc \"New Branch Name Template\"}}\n>                {c gui.encoding {mc \"Default File Contents Encoding\"}}\n> +               {b gui.warndetachedcommit {mc \"Warn before commiting to a detached head\"}}\n>                {s gui.stageuntracked {mc \"Staging of untracked files\"} {list \"yes\" \"no\" \"ask\"}}\n>                } {\n>                set type [lindex $option 0]\n\nPat,\n\nif you're interessted in this patch, please fix the typo in the second\nhunk, mentioning 'commiting'.\n\nAlso shouldn't this variable be called gui.warndetachedhead?\n\nThanks.\n\nBert\n\n> --\n> 1.7.7.908.g383b5\n>\n>\n"},{"id":"178863","messageId":"878vnvo0md.fsf@fox.patthoyts.tk","threadId":"28749","inReplyTo":"CAKPyHN24RwNjJanaMQ0AjXc2iorFw=taCmcS-iuNt0vQ46_TOg@mail.gmail.com","subject":"Re: [PATCH 1/2] git-gui: make config gui.warndetachedcommit a boolean","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-11-05T00:48:26Z","receivedAt":"2011-11-05T00:48:26Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n>On Sat, Oct 22, 2011 at 21:39, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>> ---\n>>  lib/commit.tcl |    2 +-\n>>  lib/option.tcl |    1 +\n>>  2 files changed, 2 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/lib/commit.tcl b/lib/commit.tcl\n>> index 372bed9..e27e148 100644\n>> --- a/lib/commit.tcl\n>> +++ b/lib/commit.tcl\n>> @@ -263,7 +263,7 @@ proc commit_commitmsg {curHEAD msg_p} {\n>>        global is_detached repo_config\n>>        global pch_error\n>>\n>> -       if {$is_detached && $repo_config(gui.warndetachedcommit)} {\n>> +       if {$is_detached && [is_config_true gui.warndetachedcommit]} {\n>>                set msg [mc \"You are about to commit on a detached head.\\\n>>  This is a potentially dangerous thing to do because if you switch\\\n>>  to another branch you will loose your changes and it can be difficult\\\n>> diff --git a/lib/option.tcl b/lib/option.tcl\n>> index 719103a..f7f866b 100644\n>> --- a/lib/option.tcl\n>> +++ b/lib/option.tcl\n>> @@ -156,6 +156,7 @@ proc do_options {} {\n>>                {i-0..99 gui.commitmsgwidth {mc \"Commit Message Text Width\"}}\n>>                {t gui.newbranchtemplate {mc \"New Branch Name Template\"}}\n>>                {c gui.encoding {mc \"Default File Contents Encoding\"}}\n>> +               {b gui.warndetachedcommit {mc \"Warn before commiting to a detached head\"}}\n>>                {s gui.stageuntracked {mc \"Staging of untracked files\"} {list \"yes\" \"no\" \"ask\"}}\n>>                } {\n>>                set type [lindex $option 0]\n>\n>Pat,\n>\n>if you're interessted in this patch, please fix the typo in the second\n>hunk, mentioning 'commiting'.\n>\n>Also shouldn't this variable be called gui.warndetachedhead?\n>\n>Thanks.\n>\n>Bert\n\nI've applied this with the spelling correction and also gitdir already\ndoes [file join] on its args so squashed a slight modification there\ntoo.\n\nThe flag is for warnings about commits. Calling 'warndetachedhead'\nsounds like something that would warn you when you changed to a detached\nhead - not for when you are about to commit to one so I think the name\nis fine.\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"}]}