git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bert Wesarg" <bert.wesarg@googlemail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [RFC/PATCH 1/2] for-each-ref: add new format 'refbasename'
Date: Fri, 29 Aug 2008 20:21:17 +0200	[thread overview]
Message-ID: <36ca99e90808291121j7b202917r2308719970668be3@mail.gmail.com> (raw)
In-Reply-To: <0329f1ab2642e1dab701b5fc6517bfb1b4ea2d46.1220004755.git.szeder@ira.uka.de>

On Fri, Aug 29, 2008 at 12:37, SZEDER Gábor <szeder@ira.uka.de> wrote:
> fot-each-ref's refname format outputs each ref in its full format, e.g.
> 'refs/heads/foo' and 'refs/tags/bar'.  However, there are tools that
> need only the last part of the refname, e.g. only 'foo' and 'bar'.  Such
> a tool is git's bash completion script, which spends considerable amount
> of time removing the unneeded parts from for-each-ref's output.
>
> Therefore, we introduce a new for-each-ref format called 'refbasename',
> which strips everything before and including the second '/' in the ref's
> name from the output.

Why not strip the pattern (given on the command line) from the
refname? I.e. with a new format 'refshort' a 'git for-each-ref
--format=%(refshort) refs/heads/' would strip off the refs/heads/ from
each ref.

This should also work for multiple patterns (refs/heads/ refs/tags/)
and for patterns which needs a fnmatch call (which has the
FNM_PATHNAME option).

The bash completion script calls for-each-ref always with patterns.

Bert

  parent reply	other threads:[~2008-08-29 18:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-29 10:37 [RFC/PATCH 1/2] for-each-ref: add new format 'refbasename' SZEDER Gábor
2008-08-29 10:37 ` [RFC/PATCH 2/2] bash: use for-each-ref " SZEDER Gábor
2008-08-29 14:34 ` [RFC/PATCH 1/2] for-each-ref: add new " Shawn O. Pearce
2008-08-29 16:45   ` [RFC/PATCH 1/2 v2] " SZEDER Gábor
2008-08-29 18:21 ` Bert Wesarg [this message]
2008-08-29 21:41   ` [PATCH] for-each-ref: new 'refshort' format Bert Wesarg
2008-08-31  4:31     ` Junio C Hamano
2008-08-31  7:11       ` Bert Wesarg

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=36ca99e90808291121j7b202917r2308719970668be3@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    --cc=szeder@ira.uka.de \
    /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).