From: fork0@t-online.de (Alex Riesen)
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>, Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] Trivial path optimization test
Date: Tue, 18 Jul 2006 00:34:32 +0200 [thread overview]
Message-ID: <20060717223432.GA25522@steel.home> (raw)
In-Reply-To: <Pine.LNX.4.64.0607140828250.5623@g5.osdl.org>
Linus Torvalds, Fri, Jul 14, 2006 17:39:24 +0200:
> > > Btw, I'm actually surprised that my path simplification didn't filter out
> > > the "." and make it mean exactly the same as not giving a path at all. I
> > > thought I had done that earlier, but if you say "-- ." matters, then it
> > > obviously does..
> >
> > In this specific case where I have a whole bunch of commits which don't
> > actually change anything, it definitely does make a difference...
>
> Yes, I'm looking at "get_pathspec()", and noting that it really isn't able
> to optimize away the ".".
>
> It does turn it into an empty string (which is correct - git internally
> does _not_ ever understand the notion of "." as the current working
> directory), but it doesn't ever do the optimization of noticing that a
> pathspec that consists solely of an empty string is "equivalent" to an
> empty pathspec.
>
> Which is exactly what you _want_ in this case, of course, but maybe we
> should add a test-case for that, so that we never do that trivial
> optimization by mistake.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
...
> Anybody want to write that as a test, verify it, and send Junio a patch?
>
> Linus
So here it is.
t/t6004-rev-list-path-optim.sh | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/t/t6004-rev-list-path-optim.sh b/t/t6004-rev-list-path-optim.sh
new file mode 100755
index 0000000..5182dbb
--- /dev/null
+++ b/t/t6004-rev-list-path-optim.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+test_description='git-rev-list trivial path optimization test'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+echo Hello > a &&
+git add a &&
+git commit -m "Initial commit" a
+'
+
+test_expect_success path-optimization '
+ commit=$(echo "Unchanged tree" | git-commit-tree "HEAD^{tree}" -p HEAD) &&
+ test $(git-rev-list $commit | wc -l) = 2 &&
+ test $(git-rev-list $commit -- . | wc -l) = 1
+'
+
+test_done
--
1.4.1.gb944
next prev parent reply other threads:[~2006-07-17 22:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-13 23:59 Kernel headers git tree David Woodhouse
2006-07-14 0:39 ` Junio C Hamano
2006-07-14 0:56 ` David Woodhouse
2006-07-14 1:08 ` Linus Torvalds
2006-07-14 2:37 ` Junio C Hamano
2006-07-14 1:05 ` Linus Torvalds
2006-07-14 1:27 ` David Woodhouse
2006-07-14 5:16 ` Linus Torvalds
2006-07-14 10:23 ` David Woodhouse
2006-07-14 15:57 ` Linus Torvalds
2006-07-14 17:51 ` Daniel Barkalow
2006-07-14 17:58 ` David Woodhouse
2006-07-14 18:21 ` Daniel Barkalow
2006-07-14 5:52 ` Linus Torvalds
2006-07-14 9:38 ` David Woodhouse
2006-07-14 15:39 ` Linus Torvalds
2006-07-17 22:34 ` Alex Riesen [this message]
2006-07-24 6:41 ` [PATCH] Trivial path optimization test Junio C Hamano
2006-07-24 23:23 ` Alex Riesen
2006-07-24 23:23 ` Alex Riesen
2006-07-14 18:01 ` Kernel headers git tree Junio C Hamano
2006-07-14 18:21 ` David Woodhouse
2006-07-14 7:20 ` Ian Campbell
2006-07-14 7:52 ` Junio C Hamano
2006-07-14 18:05 ` Ingo Oeser
2006-07-14 18:16 ` David Woodhouse
2006-07-18 21:15 ` Ingo Oeser
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=20060717223432.GA25522@steel.home \
--to=fork0@t-online.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=torvalds@osdl.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).