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

[StGit PATCH 1/4] Don't special-case the "master" branch during branch delete

From
Karl Hasselström <kha@treskal.com>
Date
Sep 22, 2007, 08:46 UTC
Message-ID
<20070922084619.29884.94401.stgit@yoghurt>
In-Reply-To
<20070922084334.29884.60506.stgit@yoghurt>

It's unintuitive, unsymmetric and doesn't work if there is no "master". Instead, prohibit deletion of the current branch.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 stgit/commands/branch.py |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py
index 2d491d5..8c99936 100644
--- a/stgit/commands/branch.py
+++ b/stgit/commands/branch.py
@@ -96,17 +96,10 @@ def __delete_branch(doomed_name, force = False):
     out.start('Deleting branch "%s"' % doomed_name)
 
     if __is_current_branch(doomed_name):
-        check_local_changes()
-        check_conflicts()
-        check_head_top_equal()
-
-        if doomed_name != 'master':
-            git.switch_branch('master')
+        raise CmdException('Cannot delete the current branch')
 
     doomed.delete(force)
-
-    if doomed_name != 'master':
-        git.delete_branch(doomed_name)
+    git.delete_branch(doomed_name)
 
     out.done()
 
Previous: Karl HasselströmNext: Karl Hasselström
Message 4 of 7 in “stg branch --delete doesn't work”
  1. Aneesh KumarSep 21, 2007
  2. Karl HasselströmSep 21, 2007
  3. 0/4 Fix "stg branch --delete"Karl Hasselström, Sep 22, 2007
  4. 1/4 Don't special-case the "master" branch during branch deleteKarl Hasselström, Sep 22, 2007
  5. 2/4 Don't try to delete the branch twiceKarl Hasselström, Sep 22, 2007
  6. 3/4 Properly remove all config for a deleted branchKarl Hasselström, Sep 22, 2007
  7. 4/4 Add simple test for "stg branch --delete"Karl Hasselström, Sep 22, 2007

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.