git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Conrad Irwin <conrad.irwin@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH] Prevent force updating of the current branch
Date: Sat, 20 Aug 2011 14:49:47 -0700	[thread overview]
Message-ID: <1313876989-16328-1-git-send-email-conrad.irwin@gmail.com> (raw)

I noticed when trying to improve the user-experience of creating
ambiguous branches [1] that there are insufficient checks to safeguard
git-branch -M and git-checkout -B from over-writing the current branch.

Conrad

[1] http://thread.gmane.org/gmane.comp.version-control.git/179503

---
 branch.c                   |   34 ++++++++++++++++++++++++----------
 branch.h                   |    8 ++++++++
 builtin/branch.c           |    6 +-----
 builtin/checkout.c         |   12 +++---------
 t/t2018-checkout-branch.sh |   17 +++++++++++++++++
 t/t3200-branch.sh          |   12 ++++++++++++
 6 files changed, 65 insertions(+), 24 deletions(-)

             reply	other threads:[~2011-08-20 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20 21:49 Conrad Irwin [this message]
2011-08-20 21:49 ` [PATCH 1/2] Prevent force-updating of the current branch Conrad Irwin
2011-08-23 18:20   ` Junio C Hamano
2011-08-23 19:20     ` Conrad Irwin
2011-08-20 21:49 ` [PATCH 2/2] Show interpreted branch name in error messages Conrad Irwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313876989-16328-1-git-send-email-conrad.irwin@gmail.com \
    --to=conrad.irwin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).