git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miles Bader <miles@gnu.org>
To: nathan.panike@gmail.com
Cc: Andreas Schwab <schwab@linux-m68k.org>, git@vger.kernel.org
Subject: Re: [PATCH] Specify a precision for the length of a subject string
Date: Fri, 23 Dec 2011 18:41:47 +0900	[thread overview]
Message-ID: <877h1nwrok.fsf@catnip.gol.com> (raw)
In-Reply-To: <20111221145352.GB13097@llunet.cs.wisc.edu> (Nathan Panike's message of "Wed, 21 Dec 2011 08:53:53 -0600")

Nathan Panike <nwp@cs.wisc.edu> writes:
>> > $ git log --pretty='%h %30s' d165204 -1
>> 
>> In C's formatted output this syntax denotes a minimum field width, not a
>> precision, so it will probably be surprising to many people.
>
> C semantics are already broken because (from git-log(1))
>
> "If you add a - (minus sign) after % of a placeholder, line-feeds that
> immediately precede the expansion are deleted if and only if the placeholder
> expands to an empty string."
>
> rather than indicating justification of the field.

There's no reason to make it _worse_ though...

For your desired feature, why not just use the C printf syntax for this
functionality, a leading dot before the max length?  E.g. "%.30s".

-miles

-- 
Youth, n. The Period of Possibility, when Archimedes finds a fulcrum,
Cassandra has a following and seven cities compete for the honor of endowing a
living Homer.

      reply	other threads:[~2011-12-23  9:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 22:07 [PATCH] Specify a precision for the length of a subject string Nathan W. Panike
2011-12-20 22:15 ` Thomas Rast
2011-12-20 22:50   ` Nathan Panike
2011-12-21  4:38 ` Jeff King
2011-12-21 14:51   ` Nathan Panike
2011-12-23 10:09     ` Jeff King
2011-12-23 10:35       ` Jeff King
2011-12-23 20:58         ` Junio C Hamano
2011-12-23 23:02           ` Jeff King
2011-12-23 23:03             ` Jeff King
2011-12-23 10:35       ` [PATCH 1/2] pretty: refactor --format "magic" placeholders Jeff King
2011-12-23 10:36       ` [PATCH 2/2] pretty: allow "max-size" magic for all placeholders Jeff King
2011-12-21 11:26 ` [PATCH] Specify a precision for the length of a subject string Andreas Schwab
2011-12-21 14:53   ` Nathan Panike
2011-12-23  9:41     ` Miles Bader [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

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

  git send-email \
    --in-reply-to=877h1nwrok.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=nathan.panike@gmail.com \
    --cc=schwab@linux-m68k.org \
    /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).