"git branch -D" checks first to see whether all the commits in the doomed
branch are already in the branch pointed to by HEAD. I don't think we need
that level of checking here. We just delete "refs/heads/branchname."
Signed-off-by: Chuck Lever <cel@netapp.com>
if os.path.isfile(os.path.join(base_dir, 'MERGE_HEAD')):
os.remove(os.path.join(base_dir, 'MERGE_HEAD'))
if os.path.isfile(os.path.join(base_dir, 'MERGE_HEAD')):
os.remove(os.path.join(base_dir, 'MERGE_HEAD'))
+def delete_branch(name):
+ """Delete a git branch
+ """
+ branch_head = os.path.join('refs', 'heads', name)
+ if not branch_exists(branch_head):
+ raise GitException, 'Branch "%s" does not exist' % name
+ os.remove(os.path.join(base_dir, branch_head))
+
def add(names):
"""Add the files or recursively add the directory contents
"""
def add(names):
"""Add the files or recursively add the directory contents
"""