git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH v2] git-branch: display sha1 on branch deletion
Date: Sat, 13 Dec 2008 01:31:05 -0500	[thread overview]
Message-ID: <20081213063104.GA8480@coredump.intra.peff.net> (raw)
In-Reply-To: <UfCPFu_boLV0ycLKLmOno8GTqmtC4RSZZ9O6aRLGYjmSZOdKv6ywhCjApnplTHLxUIzO8KJ5Mww@cipher.nrlssc.navy.mil>

On Fri, Dec 12, 2008 at 05:20:07PM -0600, Brandon Casey wrote:

> Make it easier to recover from a mistaken branch deletion by displaying the
> sha1 of the branch's tip commit.

This version looks fine to me, but one nit:

> -     test "$(git branch -d my7 2>&1)" = "Deleted branch my7."'
> +     sha1=$(git rev-parse my7 | cut -c 1-7) &&
> +     test "$(git branch -d my7 2>&1)" = "Deleted branch my7 ($sha1)."'

There is a very very small chance that this sha1 might require more
than 7 characters to be unique (small because we have such a tiny number
of objects in the trash repo). Maybe:

  sha1=$(git log --pretty=format:%h -1 my7)

is better (though I have to admit, if I were writing the test originally
I would have tested the exit value of "git branch" instead of the
message).

-Peff

  reply	other threads:[~2008-12-13  6:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 19:29 [PATCH] git-branch: display sha1 on branch deletion Brandon Casey
2008-12-12 19:43 ` Jeff King
2008-12-12 23:17   ` Brandon Casey
2008-12-12 23:20     ` [PATCH v2] " Brandon Casey
2008-12-13  6:31       ` Jeff King [this message]
2008-12-15 17:23         ` Brandon Casey

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=20081213063104.GA8480@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=casey@nrlssc.navy.mil \
    --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).