git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: jim.cromie@gmail.com
Cc: git@vger.kernel.org
Subject: Re: $> git branch splat response considered harmful
Date: Thu, 8 Aug 2019 23:30:02 +0200	[thread overview]
Message-ID: <20190808213002.GI20404@szeder.dev> (raw)
In-Reply-To: <CAJfuBxx5R28cjUj1v+mB4J+uUpbTMWnYowrCc=iOAbOcqWX-_w@mail.gmail.com>

On Thu, Aug 08, 2019 at 03:08:06PM -0600, jim.cromie@gmail.com wrote:
> fwiw,
> 
> jimc@frodo:~/prj-1/capnproto.git$ git branch -l
> * master
> 
> I find the splat in the response unhelpful
> when wrapped in shell for loop, the splat expands into everything in
> current directory
> 
> jimc@frodo:~/prj-1/capnproto.git$ for b in `git branch -l`; do echo $b; done
> appveyor.yml
> c++
> CMakeLists.txt
> CONTRIBUTORS
> ...
> 
> it would be nice if some flag combo would suppress that splat.
> save me from fugly brittle sh $IFS fiddlery and incomplete workarounds

'git branch' is not intended for scripting, try 'git for-each-ref'
instead.  The equivalent command should be:

  git for-each-ref --format='%(refname:strip=2)' refs/heads/

> also, I found no mention of the splat in the man page.

It's in the first sentence of the description :)

  If --list is given, or if there are no non-option arguments, existing
  branches are listed; the current branch will be highlighted in green
  and marked with an asterisk.


      parent reply	other threads:[~2019-08-08 21:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 21:08 $> git branch splat response considered harmful jim.cromie
2019-08-08 21:20 ` Bryan Turner
2019-08-08 21:28   ` Emily Shaffer
2019-08-08 21:46     ` Junio C Hamano
2019-08-09 18:01     ` Philip Oakley
2019-08-08 21:30 ` SZEDER Gábor [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20190808213002.GI20404@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jim.cromie@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).