git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: disable checkout of remote branch

From
Sitaram Chamarty <sitaramc@gmail.com>
Date
Jun 22, 2009, 03:42 UTC
Message-ID
<2e24e5b90906212042l3182b634y2a51efb645e4bcf@mail.gmail.com>
In-Reply-To
<7vtz29p3qm.fsf@alter.siamese.dyndns.org>

At the command line, this gives you a detailed warning message, but the GUI currently allows it without any fuss.

Since the GUI is often used by people much less familiar with git, it seems reasonable to make the GUI more restrictive than the command line, not less.

This prevents a lot of detached HEAD commits by new users.
Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
---
Paul,

I have amended the diff header to fit the gitk repo as opposed to the git repo. To summarise the email discussions, the feature that is being disabled gets you a detached HEAD, but if that were really the intent we should allow a detached HEAD from any commit, not just a head commit. Therefore this particular disablement is useful and makes the GUI experience safer.

Please accept.  Thanks.
 gitk |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gitk b/gitk
index 4604c83..70b6abc 100755
--- a/gitk
+++ b/gitk
@@ -8833,6 +8833,9 @@ proc headmenu {x y id head} {
     set headmenuid $id
     set headmenuhead $head
     set state normal
+    if {[string match "remotes/*" $head]} {
+	set state disabled
+    }
     if {$head eq $mainhead} {
 	set state disabled
     }
-- 
1.6.3.2
Previous: Sitaram ChamartyNext: Junio C Hamano
Message 8 of 9 in “Please pull gitk master branch”
  1. Paul MackerrasJun 20, 2009
  2. gitk: disable checkout of remote branchSitaram Chamarty, Jun 21, 2009
  3. Junio C HamanoJun 21, 2009
  4. Sitaram ChamartyJun 21, 2009
  5. Nanako ShiraishiJun 21, 2009
  6. Junio C HamanoJun 21, 2009
  7. Sitaram ChamartyJun 22, 2009
  8. gitk: disable checkout of remote branchSitaram Chamarty, Jun 22, 2009
  9. Junio C HamanoJun 21, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.