git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Steven Drake <sdrake@xnet.co.nz>
Subject: Re: log --pretty/--oneline: ignore log.decorate
Date: Thu, 8 Apr 2010 15:42:37 -0400	[thread overview]
Message-ID: <20100408194237.GA4222@sigill.intra.peff.net> (raw)
In-Reply-To: <7vljcx6f4f.fsf@alter.siamese.dyndns.org>

On Thu, Apr 08, 2010 at 10:14:24AM -0700, Junio C Hamano wrote:

> Yeah, I considered to further narrow it down to the --pretty=raw case;
> because that is not something we do for the default --show-notes, I opted
> for consistency.  But a decoration and notes are quite different, and
> such a consistency perhaps is not worth it.  How about this on top?

Since I consider normal output, --pretty=raw, and --oneline to be the
only useful output formats for git-log, I think of the right behavior
as:

  - normal: show both by default, since that is the point of the
    features

  - raw: show neither, since we are probably parsed by a script

  - oneline: don't show notes, as they are inherently multi-line. Do
    show decorations, as they inherently fit the hash+subject model

User-formats are useful, too, but outside the scope, as they should
always show exactly what was requested, and nothing more.

For the other formats, I couldn't care less. So your patch is fine, but
I would also be fine with turning it back on _just_ for --oneline, and
leaving all other pretty formats with it disabled.

The patch itself looks fine. As you know, it needs to revert some of the
test updates from your previous tip.

We should also either apply on top or squash in:

-- >8 --
Subject: [PATCH] script with rev-list instead of log

Because log.decorate now shows decorations for --pretty=oneline,
we must explicitly turn it off when scripting. Otherwise,
users with log.decorate set will get cruft like:

  $ git stash
  Saved working directory and index state WIP on master:
    2c1f7f5 (HEAD, master) commit subject

Instead of adding --no-decorate to the log command line,
let's just use the rev-list plumbing interface instead,
which does the right thing.

git-submodule has a similar call. Since it just counts the
commit lines, nothing is broken, but let's switch it, too,
for the sake of consistency and cleanliness.

Signed-off-by: Jeff King <peff@peff.net>
---
I think these changes are Obviously Correct (tm), but please confirm
that I am not missing something subtle.

 git-stash.sh     |    2 +-
 git-submodule.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 62beae0..abaeee7 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -57,7 +57,7 @@ create_stash () {
 	# state of the base commit
 	if b_commit=$(git rev-parse --verify HEAD)
 	then
-		head=$(git log --no-color --abbrev-commit --pretty=oneline -n 1 HEAD --)
+		head=$(git rev-list --oneline -n 1 HEAD --)
 	else
 		die "You do not have the initial commit yet"
 	fi
diff --git a/git-submodule.sh b/git-submodule.sh
index 2dd372a..187461c 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -648,7 +648,7 @@ cmd_summary() {
 				range=$sha1_dst
 			fi
 			GIT_DIR="$name/.git" \
-			git log --pretty=oneline --first-parent $range | wc -l
+			git rev-list --first-parent $range -- | wc -l
 			)
 			total_commits=" ($(($total_commits + 0)))"
 			;;
-- 
1.7.1.rc0.248.g055378.dirty

  reply	other threads:[~2010-04-08 19:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-04 19:14 What's cooking in git.git (Apr 2010, #02; Sun, 04) Junio C Hamano
2010-04-06  1:12 ` Michael J Gruber
2010-04-06  4:42   ` Jeff King
2010-04-06 21:48 ` log --pretty/--oneline: ignore log.decorate Junio C Hamano
2010-04-08  7:30   ` Jeff King
2010-04-08 17:14     ` Junio C Hamano
2010-04-08 19:42       ` Jeff King [this message]
2010-04-08 21:13         ` Junio C Hamano

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=20100408194237.GA4222@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sdrake@xnet.co.nz \
    /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).