All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Simplify '--prett=xyz' options
Date: Sat, 15 Aug 2009 14:39:58 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0908151434250.3162@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0908151236250.3162@localhost.localdomain>



On Sat, 15 Aug 2009, Linus Torvalds wrote:
> 
> I would like to also make "--pretty=oneline" have the same abbrev-commit 
> semantics as "--oneline" has, but I didn't actually do that change.

Here's a patch if anybody cares.

It basically replaces the tests that do

	cut -b42-

or

	sed -e "s/^.\{41\}//"

(to get just the subject) with

	sed -e "s/^[0-9a-f]* //"

instead (which is an already pre-existing pattern that some other tests 
used).

The patch itself was trivial. The only question is whether the semantic 
change is ok (it certainly makes _sense_, it's just silly how "--oneline" 
is different from "--pretty=oneline"). 

This patch obviously depends on the previous one, since it just removes 
the special-casing of "--oneline" (it now falls out automatically from the 
"if you can't recognize the flag, see if it's a format flag" logic, and is 
no longer a special case).

The 'format/tformat' misdesigns I've not touched.

		Linus

---
 pretty.c                      |    4 +++-
 revision.c                    |    4 ----
 t/t3413-rebase-hook.sh        |    2 +-
 t/t5510-fetch.sh              |    2 +-
 t/t6009-rev-list-parent.sh    |    2 +-
 t/t9108-git-svn-glob.sh       |    4 ++--
 t/t9109-git-svn-multi-glob.sh |    6 +++---
 7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/pretty.c b/pretty.c
index 1a76320..6d0fa60 100644
--- a/pretty.c
+++ b/pretty.c
@@ -52,8 +52,10 @@ int try_get_commit_format(const char *arg, struct rev_info *rev)
 	for (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) {
 		if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len) &&
 		    !strncmp(arg, cmt_fmts[i].n, strlen(arg))) {
-			if (cmt_fmts[i].v == CMIT_FMT_ONELINE)
+			if (cmt_fmts[i].v == CMIT_FMT_ONELINE) {
 				rev->use_terminator = 1;
+				rev->abbrev_commit = 1;
+			}
 			rev->commit_format = cmt_fmts[i].v;
 			return 1;
 		}
diff --git a/revision.c b/revision.c
index bdace8b..b7f047a 100644
--- a/revision.c
+++ b/revision.c
@@ -1126,10 +1126,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 	} else if (!prefixcmp(arg, "--pretty=")) {
 		revs->verbose_header = 1;
 		get_commit_format(arg+9, revs);
-	} else if (!strcmp(arg, "--oneline")) {
-		revs->verbose_header = 1;
-		get_commit_format("oneline", revs);
-		revs->abbrev_commit = 1;
 	} else if (!strcmp(arg, "--graph")) {
 		revs->topo_order = 1;
 		revs->rewrite_parents = 1;
diff --git a/t/t3413-rebase-hook.sh b/t/t3413-rebase-hook.sh
index 098b755..2f14c5c 100755
--- a/t/t3413-rebase-hook.sh
+++ b/t/t3413-rebase-hook.sh
@@ -19,7 +19,7 @@ test_expect_success setup '
 	test_tick &&
 	git commit -m side &&
 	git checkout master &&
-	git log --pretty=oneline --abbrev-commit --graph --all &&
+	git log --oneline --graph --all &&
 	git branch test side
 '
 
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index d13c806..62a45c0 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -168,7 +168,7 @@ test_expect_success 'bundle 1 has only 3 files ' '
 test_expect_success 'unbundle 2' '
 	cd "$D/bundle" &&
 	git fetch ../bundle2 master:master &&
-	test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)"
+	test "tip" = "$(git log -1 --pretty=oneline master | sed 's/^[0-9a-f]* //')"
 '
 
 test_expect_success 'bundle does not prerequisite objects' '
diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh
index c8a96a9..9a90ce8 100755
--- a/t/t6009-rev-list-parent.sh
+++ b/t/t6009-rev-list-parent.sh
@@ -24,7 +24,7 @@ test_expect_success setup '
 	commit three &&
 	commit four &&
 
-	git log --pretty=oneline --abbrev-commit
+	git log --oneline
 '
 
 test_expect_success 'one is ancestor of others and should not be shown' '
diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh
index d732d31..4d386f2 100755
--- a/t/t9108-git-svn-glob.sh
+++ b/t/t9108-git-svn-glob.sh
@@ -48,7 +48,7 @@ test_expect_success 'test refspec globbing' '
 	                 "tags/*/src/a:refs/remotes/tags/*" &&
 	git svn multi-fetch &&
 	git log --pretty=oneline refs/remotes/tags/end | \
-	    sed -e "s/^.\{41\}//" > output.end &&
+	    sed -e "s/^[0-9a-f]* //" > output.end &&
 	test_cmp expect.end output.end &&
 	test "`git rev-parse refs/remotes/tags/end~1`" = \
 		"`git rev-parse refs/remotes/branches/start`" &&
@@ -82,7 +82,7 @@ test_expect_success 'test left-hand-side only globbing' '
 	test `git rev-parse refs/remotes/two/tags/end~3` = \
 	     `git rev-parse refs/remotes/two/branches/start` &&
 	git log --pretty=oneline refs/remotes/two/tags/end | \
-	    sed -e "s/^.\{41\}//" > output.two &&
+	    sed -e "s/^[0-9a-f]* //" > output.two &&
 	test_cmp expect.two output.two
 	'
 
diff --git a/t/t9109-git-svn-multi-glob.sh b/t/t9109-git-svn-multi-glob.sh
index c318f9f..da93cf1 100755
--- a/t/t9109-git-svn-multi-glob.sh
+++ b/t/t9109-git-svn-multi-glob.sh
@@ -48,7 +48,7 @@ test_expect_success 'test refspec globbing' '
 	                 "tags/*/src/a:refs/remotes/tags/*" &&
 	git svn multi-fetch &&
 	git log --pretty=oneline refs/remotes/tags/end | \
-	    sed -e "s/^.\{41\}//" > output.end &&
+	    sed -e "s/^[0-9a-f]* //" > output.end &&
 	test_cmp expect.end output.end &&
 	test "`git rev-parse refs/remotes/tags/end~1`" = \
 		"`git rev-parse refs/remotes/branches/v1/start`" &&
@@ -82,7 +82,7 @@ test_expect_success 'test left-hand-side only globbing' '
 	test `git rev-parse refs/remotes/two/tags/end~3` = \
 	     `git rev-parse refs/remotes/two/branches/v1/start` &&
 	git log --pretty=oneline refs/remotes/two/tags/end | \
-	    sed -e "s/^.\{41\}//" > output.two &&
+	    sed -e "s/^[0-9a-f]* //" > output.two &&
 	test_cmp expect.two output.two
 	'
 cat > expect.four <<EOF
@@ -131,7 +131,7 @@ test_expect_success 'test another branch' '
 	test `git rev-parse refs/remotes/four/tags/next~2` = \
 	     `git rev-parse refs/remotes/four/branches/v2/start` &&
 	git log --pretty=oneline refs/remotes/four/tags/next | \
-	    sed -e "s/^.\{41\}//" > output.four &&
+	    sed -e "s/^[0-9a-f]* //" > output.four &&
 	test_cmp expect.four output.four
 	'
 

  parent reply	other threads:[~2009-08-15 21:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-15 19:01 Simplify '--prett=xyz' options Linus Torvalds
2009-08-15 19:19 ` Thomas Rast
2009-08-15 19:50   ` Linus Torvalds
2009-08-15 20:16     ` Junio C Hamano
2009-08-15 20:36       ` Linus Torvalds
2009-08-15 21:05         ` Avery Pennarun
2009-08-15 21:29           ` Linus Torvalds
2009-08-15 21:39     ` Linus Torvalds [this message]
2009-08-15 20:22 ` Johannes Schindelin

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=alpine.LFD.2.01.0908151434250.3162@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.