public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Elena Petrashen <elena.petrashen@gmail•com>
Cc: git@vger•kernel.org, sunshine@sunshineco•com,
	Matthieu.Moy@grenoble-inp•fr, sbeller@google•com
Subject: Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'
Date: Tue, 22 Mar 2016 10:12:00 -0700	[thread overview]
Message-ID: <xmqqwpouigin.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq1t72jvac.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Tue, 22 Mar 2016 10:07:39 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> I _think_ strbuf_branchname() leaves "@{-<N>}" when you do not have
> enough branch switches in the reflog, so perhaps ...

This is a tangent, but the value returned from strbuf_branchname()
is not well documented, and nobody looks at it.  It might not be a
bad idea to change the return value from the function in such a way
that it can signal "I saw @{-<N>} syntax but there weren't enough
branch switches" and also "I saw branch@{upstream} syntax but that
branch does not have an upstream configured for it" to its callers.

That way, the suggested "perhaps like this..." patch does not have
to do an ugly hack: if (starts_with(bname.buf, "@{-")).

  reply	other threads:[~2016-03-22 17:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22  8:24 [PATCH v2] branch -D: allow - as abbreviation of '@{-1}' Elena Petrashen
2016-03-22 10:00 ` Matthieu Moy
2016-03-22 17:07 ` Junio C Hamano
2016-03-22 17:12   ` Junio C Hamano [this message]
2016-03-22 18:57     ` Eric Sunshine
2016-03-24 13:00   ` elena petrashen

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=xmqqwpouigin.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Matthieu.Moy@grenoble-inp$(echo .)fr \
    --cc=elena.petrashen@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=sbeller@google$(echo .)com \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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