Git development
 help / color / mirror / Atom feed
* [PATCH 1/4] Add a testsuite framework copied from git-core
From: Yann Dirson @ 2006-04-13 21:44 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git
In-Reply-To: <20060413213819.8806.53300.stgit@gandelf.nowhere.earth>

From: Yann Dirson <ydirson@altern.org>

See git's t/README for details on how to use this framework.

There is no integration yet in the toplevel Makefile, I'll let
python masters take care of this.  Use "make -C t" to run the
tests for now.

A patch-naming policy should be defined for stgit, since the
git one does not apply.
---

 TODO             |    2 -
 t/Makefile       |   25 ++++++
 t/t0000-dummy.sh |   19 +++++
 t/test-lib.sh    |  208 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 253 insertions(+), 1 deletions(-)

diff --git a/TODO b/TODO
index e5affe0..d97ffd1 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,7 @@ The TODO list until 1.0:
 - debian package support
 - man page
 - code execution allowed from templates
-- regression tests
+- more regression tests
 - release 1.0
 
 
diff --git a/t/Makefile b/t/Makefile
new file mode 100644
index 0000000..d5d7b6f
--- /dev/null
+++ b/t/Makefile
@@ -0,0 +1,25 @@
+# Run tests
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+#GIT_TEST_OPTS=--verbose --debug
+SHELL_PATH ?= $(SHELL)
+TAR ?= $(TAR)
+
+# Shell quote;
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
+
+all: $(T) clean
+
+$(T):
+	@echo "*** $@ ***"; '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
+
+clean:
+	rm -fr trash
+
+.PHONY: $(T) clean
+.NOPARALLEL:
+
diff --git a/t/t0000-dummy.sh b/t/t0000-dummy.sh
new file mode 100755
index 0000000..8dc25d3
--- /dev/null
+++ b/t/t0000-dummy.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Yann Dirson
+#
+
+test_description='Dummy test.
+
+Only to test the testing environment.
+'
+
+. ./test-lib.sh
+
+test_stg_init
+
+test_expect_success \
+    'check stgit can be run' \
+    'stg version'
+
+test_done
diff --git a/t/test-lib.sh b/t/test-lib.sh
new file mode 100755
index 0000000..2580bcc
--- /dev/null
+++ b/t/test-lib.sh
@@ -0,0 +1,208 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+# Copyright (c) 2006 Yann Dirson
+#
+
+# For repeatability, reset the environment to known value.
+LANG=C
+LC_ALL=C
+PAGER=cat
+TZ=UTC
+export LANG LC_ALL PAGER TZ
+unset AUTHOR_DATE
+unset AUTHOR_EMAIL
+unset AUTHOR_NAME
+unset COMMIT_AUTHOR_EMAIL
+unset COMMIT_AUTHOR_NAME
+unset GIT_ALTERNATE_OBJECT_DIRECTORIES
+unset GIT_AUTHOR_DATE
+GIT_AUTHOR_EMAIL=author@example.com
+GIT_AUTHOR_NAME='A U Thor'
+unset GIT_COMMITTER_DATE
+GIT_COMMITTER_EMAIL=committer@example.com
+GIT_COMMITTER_NAME='C O Mitter'
+unset GIT_DIFF_OPTS
+unset GIT_DIR
+unset GIT_EXTERNAL_DIFF
+unset GIT_INDEX_FILE
+unset GIT_OBJECT_DIRECTORY
+unset SHA1_FILE_DIRECTORIES
+unset SHA1_FILE_DIRECTORY
+export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
+export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
+
+# Each test should start with something like this, after copyright notices:
+#
+# test_description='Description of this test...
+# This test checks if command xyzzy does the right thing...
+# '
+# . ./test-lib.sh
+
+error () {
+	echo "* error: $*"
+	trap - exit
+	exit 1
+}
+
+say () {
+	echo "* $*"
+}
+
+test "${test_description}" != "" ||
+error "Test script did not set test_description."
+
+while test "$#" -ne 0
+do
+	case "$1" in
+	-d|--d|--de|--deb|--debu|--debug)
+		debug=t; shift ;;
+	-i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate)
+		immediate=t; shift ;;
+	-h|--h|--he|--hel|--help)
+		echo "$test_description"
+		exit 0 ;;
+	-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
+		verbose=t; shift ;;
+	*)
+		break ;;
+	esac
+done
+
+exec 5>&1
+if test "$verbose" = "t"
+then
+	exec 4>&2 3>&1
+else
+	exec 4>/dev/null 3>/dev/null
+fi
+
+test_failure=0
+test_count=0
+
+trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
+
+
+# You are not expected to call test_ok_ and test_failure_ directly, use
+# the text_expect_* functions instead.
+
+test_ok_ () {
+	test_count=$(expr "$test_count" + 1)
+	say "  ok $test_count: $@"
+}
+
+test_failure_ () {
+	test_count=$(expr "$test_count" + 1)
+	test_failure=$(expr "$test_failure" + 1);
+	say "FAIL $test_count: $1"
+	shift
+	echo "$@" | sed -e 's/^/	/'
+	test "$immediate" = "" || { trap - exit; exit 1; }
+}
+
+
+test_debug () {
+	test "$debug" = "" || eval "$1"
+}
+
+test_run_ () {
+	eval >&3 2>&4 "$1"
+	eval_ret="$?"
+	return 0
+}
+
+test_expect_failure () {
+	test "$#" = 2 ||
+	error "bug in the test script: not 2 parameters to test-expect-failure"
+	say >&3 "expecting failure: $2"
+	test_run_ "$2"
+	if [ "$?" = 0 -a "$eval_ret" != 0 ]
+	then
+		test_ok_ "$1"
+	else
+		test_failure_ "$@"
+	fi
+}
+
+test_expect_success () {
+	test "$#" = 2 ||
+	error "bug in the test script: not 2 parameters to test-expect-success"
+	say >&3 "expecting success: $2"
+	test_run_ "$2"
+	if [ "$?" = 0 -a "$eval_ret" = 0 ]
+	then
+		test_ok_ "$1"
+	else
+		test_failure_ "$@"
+	fi
+}
+
+test_expect_code () {
+	test "$#" = 3 ||
+	error "bug in the test script: not 3 parameters to test-expect-code"
+	say >&3 "expecting exit code $1: $3"
+	test_run_ "$3"
+	if [ "$?" = 0 -a "$eval_ret" = "$1" ]
+	then
+		test_ok_ "$2"
+	else
+		test_failure_ "$@"
+	fi
+}
+
+# Most tests can use the created repository, but some amy need to create more.
+# Usage: test_create_repo <directory>
+test_create_repo () {
+	test "$#" = 1 ||
+	error "bug in the test script: not 1 parameter to test-create-repo"
+	owd=`pwd`
+	repo="$1"
+	mkdir "$repo"
+	cd "$repo" || error "Cannot setup test environment"
+	git-init-db 2>/dev/null ||
+	error "cannot run git-init-db -- have you installed git-core?"
+	mv .git/hooks .git/hooks-disabled
+	cd "$owd"
+}
+
+test_stg_init () {
+	echo "empty start" |
+	git-commit-tree `git-write-tree` >.git/refs/heads/master 2>/dev/null ||
+	error "cannot run git-commit -- is your git-core funtionning?"
+	stg init ||
+	error "cannot run stg init -- have you built things yet?"
+}
+
+test_done () {
+	trap - exit
+	case "$test_failure" in
+	0)
+		# We could:
+		# cd .. && rm -fr trash
+		# but that means we forbid any tests that use their own
+		# subdirectory from calling test_done without coming back
+		# to where they started from.
+		# The Makefile provided will clean this test area so
+		# we will leave things as they are.
+
+		say "passed all $test_count test(s)"
+		exit 0 ;;
+
+	*)
+		say "failed $test_failure among $test_count test(s)"
+		exit 1 ;;
+
+	esac
+}
+
+# Test the binaries we have just built.  The tests are kept in
+# t/ subdirectory and are run in trash subdirectory.
+PATH=$(pwd)/..:$PATH
+export PATH
+
+
+# Test repository
+test=trash
+rm -fr "$test"
+test_create_repo $test
+cd "$test"

^ permalink raw reply related

* [PATCH 0/4] Add a testsuite to stgit (take 2)
From: Yann Dirson @ 2006-04-13 21:38 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

This is an update of the previous patch series, including minor improvements
to the way the test engine is adapted to stgit, as well as a new testsuite
demonstrating robustness issues on series creation, and proposed fixes for all
those bugs.  And hopefully more standard patches.

-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Johannes Schindelin @ 2006-04-13 20:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v64ld2uyv.fsf@assigned-by-dhcp.cox.net>

Hi,

On Thu, 13 Apr 2006, Junio C Hamano wrote:

> For an added line, xdl_emit_diffrec(rec, size, " ", 1, ecb) is
> called, which gives mb[0].ptr = " " and mb[1].ptr = <the
> contents of the line>; fn_diffstat() is called with (nbuf == 2).

Silly me. I did not check that code, but assumed that mb Just Contains 
Whole Lines...

> Instead of driving diffstat code from run_diff(),
> run_diff_cmd(), and builtin_diff(), I think it would be much
> cleaner to define diff_flush_stat() as a sibling to
> diff_flush_raw() and diff_flush_patch(), and bypass the
> run_diff() chain.

I guess you're right. It is also more work :-(

There is another bug: if a file is created, you see "ev/null" as filename. 
Ugly.

I'll try to fix it.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Linus Torvalds @ 2006-04-13 19:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vwtdt1f10.fsf@assigned-by-dhcp.cox.net>



On Thu, 13 Apr 2006, Junio C Hamano wrote:
> 
> Yes that happens to be the case _now_.  I just did not want to
> worry about future breakage, in case if Davide ever wants to
> change how mb[] is prepared for whatever reason.

I'd be worried if we depended on an external version of xdiff, but as it 
is, we'd see all changes to our local xdiff implementation, so...

It's not like either of the statements
 - we always get whole lines
 - the first memory block is always non-empty
is really very controversial ;)

		Linus

^ permalink raw reply

* Re: Test fails on ubuntu breezy
From: Junio C Hamano @ 2006-04-13 18:56 UTC (permalink / raw)
  To: linux, Peter Eriksen, Aneesh Kumar; +Cc: git, Carl Worth
In-Reply-To: <20060413115447.11819.qmail@science.horizon.com>

linux@horizon.com writes:

> I've recently encountered the same problem with t/t3600-rm.sh step 9,
> but I put it down to compiling as root.
>
> Basically, the chmod of the directory didn't stop the delete from
> happening, since I had umask 002 and it was g+w.
>
> Anyway, that test is fragile.

Indeed.  I am not sure about test #5, but here is my stab at
fixing test #9.

-- >8 --
[PATCH] t3600-rm: skip failed-remove test when we cannot make an unremovable file

When running t3600-rm test under fakeroot (or as root), we
cannot make a file unremovable with "chmod a-w .".  Detect this
case early and skip that test.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index d1947e1..acaa4d6 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -23,6 +23,16 @@ else
     test_tabs=n
 fi
 
+# Later we will try removing an unremovable path to make sure
+# git-rm barfs, but if the test is run as root that cannot be
+# arranged.
+: >test-file
+chmod a-w .
+rm -f test-file
+test -f test-file && test_failed_remove=y
+chmod 775 .
+rm -f test-file
+
 test_expect_success \
     'Pre-check that foo exists and is in index before git-rm foo' \
     '[ -f foo ] && git-ls-files --error-unmatch foo'
@@ -56,12 +66,14 @@ test "$test_tabs" = y && test_expect_suc
     "git-rm -f 'space embedded' 'tab	embedded' 'newline
 embedded'"
 
-if test "$test_tabs" = y; then
-chmod u-w .
+if test "$test_failed_remove" = y; then
+chmod a-w .
 test_expect_failure \
     'Test that "git-rm -f" fails if its rm fails' \
     'git-rm -f baz'
-chmod u+w .
+chmod 775 .
+else
+    test_expect_success 'skipping removal failure (perhaps running as root?)' :
 fi
 
 test_expect_success \

^ permalink raw reply related

* Re: [PATCH] diff-options: add --stat
From: Junio C Hamano @ 2006-04-13 18:55 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604131138080.14565@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> I think you can just depend on it being in mb[0].ptr[0], no?

Yes that happens to be the case _now_.  I just did not want to
worry about future breakage, in case if Davide ever wants to
change how mb[] is prepared for whatever reason.

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Linus Torvalds @ 2006-04-13 18:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git
In-Reply-To: <7v64ld2uyv.fsf@assigned-by-dhcp.cox.net>



On Thu, 13 Apr 2006, Junio C Hamano wrote:
> 
> I like what this tries to do (as I already said), but there are
> issues with the way it does it; here are some comments.
> 
> > +static int fn_diffstat(void *priv, mmbuffer_t *mb, int nbuf)
> > +{
> > +...
> > +	for (i = 0; i < nbuf; i++)
> > +		if (mb[i].ptr[0] == '+')
> > +			x->added++;
> > +		else if (mb[i].ptr[0] == '-')
> > +			x->deleted++;
> > +	return 0;
> > +}
> 
> This is broken if you have a hunk that adds, deletes or
> leaves a line that happens to begin with a plus or a minus.

I think you can just depend on it being in mb[0].ptr[0], no?

xdiff always gives full lines at a time, afaik, and mb[0] always ends up 
being available.

		Linus

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Junio C Hamano @ 2006-04-13 18:26 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0604130301240.28688@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Now you can say "git diff --stat" (to get an idea how many changes are
> uncommitted), or "git log --stat" (to get an idea how many changes were
> committed).

I like what this tries to do (as I already said), but there are
issues with the way it does it; here are some comments.

> +static int fn_diffstat(void *priv, mmbuffer_t *mb, int nbuf)
> +{
> +...
> +	for (i = 0; i < nbuf; i++)
> +		if (mb[i].ptr[0] == '+')
> +			x->added++;
> +		else if (mb[i].ptr[0] == '-')
> +			x->deleted++;
> +	return 0;
> +}

This is broken if you have a hunk that adds, deletes or
leaves a line that happens to begin with a plus or a minus.

A demonstration.

        : siamese; ./git-diff-files -p
        diff --git a/Makefile b/Makefile
        index 1130af4..389143e 100644
        --- a/Makefile
        +++ b/Makefile
        @@ -1,3 +1,4 @@
        +-this new line begins with a minus
         # The default target of this Makefile is...
         all:
         
        : siamese; ./git-diff-files --stat
        ---
         Makefile |    2 +-
         1 files changed, 1 insertions(+), 1 deletions(-)

For an added line, xdl_emit_diffrec(rec, size, " ", 1, ecb) is
called, which gives mb[0].ptr = " " and mb[1].ptr = <the
contents of the line>; fn_diffstat() is called with (nbuf == 2).
You are counting the addition mark '+', but you are counting the
minus at the beginning of '-this new line...'.

A fragile workaround would be to make fn_diffstat() aware of
what the caller does and look only at mb[0], with a note to the
poor soul who needs to debug future breakage if xdiff side ever
changes.

A less efficient but more futureproof alternative is to use
xdiff-interface.c::xdiff_outf() to make sure your callback is
fed one line at a time (an example of how this can be done is
found in combine-diff.c::combine_diff()).

For the original "emit everything to stdout" code Linus did,
this was not a problem, because that usage does not care about
the record boundary.  For this "counting '+' and '-' at the
beginning of each hunk data", you do.

> @@ -221,43 +367,49 @@ static void builtin_diff(const char *nam
>  	b_two = quote_two("b/", name_b);
>  	lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
>  	lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
>...
> +	if (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2)) {
> +		if (diffstat)
> +			diffstat_binary(diffstat, lbl[0]);
> +		else
> +			printf("Binary files %s and %s differ\n",
> +					lbl[0], lbl[1]);
> +	} else {
>...
> @@ -690,16 +843,19 @@ static void run_diff_cmd(const char *pgm
>  			 struct diff_filespec *one,
>  			 struct diff_filespec *two,
>  			 const char *xfrm_msg,
> -			 int complete_rewrite)
> +			 int complete_rewrite,
> +			 struct diffstat_t *diffstat)
>  {
>  	if (pgm) {
> +		if (diffstat)
> +			die ("Cannot use diffstat with external diff");
>  		run_external_diff(pgm, name, other, one, two, xfrm_msg,
>  				  complete_rewrite);
>  		return;
>  	}

Instead of driving diffstat code from run_diff(),
run_diff_cmd(), and builtin_diff(), I think it would be much
cleaner to define diff_flush_stat() as a sibling to
diff_flush_raw() and diff_flush_patch(), and bypass the
run_diff() chain.  There will be some stuff you can reuse from
builtin_diff() (mostly how it interfaces with xdiff library), so
split that out as a separate function, and call it from both
builtin_diff() and diff_flush_stat().  Then you do not have to
say "Cannot use diffstat with external diff"; even when you
usually use your wdiff based external diff, you would want an
option to get diffstat, no?  This is even more true if we are to
have three bools to toggle which format to enable like I said in
my previous message with --with-raw --with-stat --with-patch
options.

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Marco Costalba @ 2006-04-13 17:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git
In-Reply-To: <7vek02ynif.fsf@assigned-by-dhcp.cox.net>

On 4/13/06, Junio C Hamano <junkio@cox.net> wrote:
> Junio C Hamano <junkio@cox.net> writes:
>
> It is very
> likely that diff-stat followed by diff-patch would be a popular
> format (that is what git-format-patch does),

Yes, it is very likely the new output format (stat+patch) will be the
default in qgit diff window viewer ;-)

Marco

^ permalink raw reply

* Use less memory in "git log"
From: Linus Torvalds @ 2006-04-13 17:01 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


This trivially avoids keeping the commit message data around after we 
don't need it any more, avoiding a continually growing "git log" memory 
footprint.

It's not a huge deal, but it's somewhat noticeable. For the current kernel 
tree, doing a full "git log" I got

 - before: /usr/bin/time git log > /dev/null 
	0.81user 0.02system 0:00.84elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+8851minor)pagefaults 0swaps

 - after: /usr/bin/time git log > /dev/null 
	0.79user 0.03system 0:00.83elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+5039minor)pagefaults 0swaps

ie the touched pages dropped from 8851 to 5039. For the historic kernel 
archive, the numbers are 18357->11037 minor page faults.

We could/should in theory free the commits themselves, but that's really a 
lot harder, since during revision traversal we may hit the same commit 
twice through different children having it as a parent, even after we've 
shown it once (when that happens, we'll silently ignore it next time, but 
we still need the "struct commit" to know).

And as the commit message data is clearly the biggest part of the commit, 
this is the really easy 60% solution.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/git.c b/git.c
index d6f17db..78ed403 100644
--- a/git.c
+++ b/git.c
@@ -391,6 +391,8 @@ static int cmd_log(int argc, const char 
 		if (do_diff)
 			log_tree_commit(&opt, commit);
 		shown = 1;
+		free(commit->buffer);
+		commit->buffer = NULL;
 	}
 	free(buf);
 	return 0;

^ permalink raw reply related

* Re: Common option parsing..
From: Linus Torvalds @ 2006-04-13 14:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmzeq12zd.fsf@assigned-by-dhcp.cox.net>



On Wed, 12 Apr 2006, Junio C Hamano wrote:
> 
> However, I am not sure about the two-revs case.  I suspect the
> incoming items are sorted in the revs->commits list

Not by the argument parsing. That happens by "rev_parse_setup()" when we 
start to do the revision walking. 

So after setup_revisions() it's all good (although I think the list may be 
in "reverse order", I didn't check).

		Linus

^ permalink raw reply

* Re: [PATCH] Implement limited context matching in git-apply.
From: Eric W. Biederman @ 2006-04-13 12:02 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0604111100510.10745@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> On Mon, 10 Apr 2006, Eric W. Biederman wrote:
>> 
>> So at a quick inspection it looks to me like:
>> About .059s to perform to check for missing files.
>> About .019s to write the new tree.
>> About .155s in start up overhead, read_cache, and sanity checks.
>> 
>> So at a first glance it looks like librification to
>> allow the redundant work to be skipped, is where
>> the big speed win on my machine would be.
>
> That sounded wrong to me, so I did a stupid patch to datestamp the 
> different phases of git-write-tree, and here's what it says for me:
>
>      0.000479 setup_git_directory
>      0.008333 read_cache
>      0.000813 ce_stage check
>      0.001838 tree validity check
>      0.037233 write_tree itself
>
> 	real    0m0.051s
> 	user    0m0.044s
> 	sys     0m0.008s
>
> all times are in seconds. 

Ok.  This is interesting and probably reveals what is different
about my setup.  For you user+sys = real.  For me there was
a significant gap.  So it looks like for some reason I was not
succeeding in keeping .git/index hot in the page cache.

When you are I/O bound it does make sense for read_cache
to be the dominate time.  I just need to track what is up
with my machine that makes me I/O bound.  Having too little
ram is an obvious candidate but it is too simple.  Currently
out of 512M I only have 21M in the page cache which sounds
really low.  Something for me to look at.

> Which would imply pretty major surgery - you'd have to add the tree entry 
> information to the index file, and make sure they got invalidated properly 
> (all the way to the root) whenever adding/deleting/updating a path in the 
> index file.
>
> Quite frankly, I don't think it's really worth it.

For the current size of the kernel tree I agree.

It is a potential scaling limitation and if someone starts
tracking really big tress with git it may be worth revisiting.

> Yes, it would speed up applying of huge patch-sets, but it's not like 
> we're really slow at that even now, and I suspect you'd be better off 
> trying to either live with it, or trying to see if you could change your 
> workflow. There clearly _are_ tools that are better at handling pure 
> patches, with quilt being the obvious example.

Probably.  For my workflow not having to switch tool chains is
the biggest win.  Which is part of what the -C is about.


> I routinely apply 100-200 patches in a go, and that's fast enough to not 
> even be an issue. Yes, I have reasonably fast hardware, but we're likely 
> talking thousands of patches in a series for it to be _really_ painful 
> even on pretty basic developer hardware. Even a slow machine should do a 
> few hundred patches in a couple of minutes.
>
> Maybe enough time to get a cup of coffee, but no more than it would take 
> to compile the project.

Agreed.  I did the analysis so I could understand what was going on.
If the analysis revealed low hanging fruit I would have plucked it.

Eric

^ permalink raw reply

* Re: Test fails on ubuntu breezy
From: linux @ 2006-04-13 11:54 UTC (permalink / raw)
  To: git

I've recently encountered the same problem with t/t3600-rm.sh step 9,
but I put it down to compiling as root.

Basically, the chmod of the directory didn't stop the delete from
happening, since I had umask 002 and it was g+w.

Anyway, that test is fragile.

^ permalink raw reply

* Re: Test fails on ubuntu breezy
From: Peter Eriksen @ 2006-04-13 10:20 UTC (permalink / raw)
  To: Git Mailing List
In-Reply-To: <cc723f590604130053k6896c0cfkd8ea648e91d50d0e@mail.gmail.com>

On Thu, Apr 13, 2006 at 01:23:07PM +0530, Aneesh Kumar wrote:
> kvaneesh@home:~/git-work/git.build/t$ ./t3600-rm.sh
> Committing initial tree e5c556e46aae6124ff4a2a466c95004e92d9a2e4
> *   ok 1: Pre-check that foo exists and is in index before git-rm foo
> *   ok 2: Test that git-rm foo succeeds
> *   ok 3: Post-check that foo exists but is not in index after git-rm foo
> *   ok 4: Pre-check that bar exists and is in index before "git-rm -f bar"
> *   ok 5: Test that "git-rm -f bar" succeeds
> *   ok 6: Post-check that bar does not exist and is not in index after
> "git-rm -f bar"
> *   ok 7: Test that "git-rm -- -q" succeeds (remove a file that looks
> like an option)
> *   ok 8: Test that "git-rm -f" succeeds with embedded space, tab, or
> newline characters.
> * FAIL 9: Test that "git-rm -f" fails if its rm fails
>         git-rm -f baz
> *   ok 10: When the rm in "git-rm -f" fails, it should not remove the
> file from the index
> * failed 1 among 10 test(s)
> kvaneesh@home:~/git-work/git.build/t$

On solaris 10 too, only test 5 also fails.

Peter

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Johannes Schindelin @ 2006-04-13  8:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vek02ynif.fsf@assigned-by-dhcp.cox.net>

Hi,

On Wed, 12 Apr 2006, Junio C Hamano wrote:

> Junio C Hamano <junkio@cox.net> writes:
> 
> > I wonder if you can also make this an independent option that
> > prepends diffstat in front of the patch, just like the way the
> > new flag --patch-with-raw flag prepends raw output in front of
> > the patch.
> 
> Clarification.
> 
> Traditionally, we had diff-raw and diff-patch formats.
> We can think of --name-status and --name-only variants of
> diff-raw (just like different --abbrev settings give different
> visuals for diff-raw).  Until very recently, these were either-or
> output formats, but for Cogito we added an option to show both.
> 
> We could reorganize the output format options to:
> 
> 	- diff-raw and its name variants
> 	- diff-stat
>         - diff-patch
> 
> and have (internally) three bools to specify which ones to
> output, in the above order.  The recent --patch-with-raw would
> flip bit #0 (show raw) and bit #2 (show patch) on.  It is very
> likely that diff-stat followed by diff-patch would be a popular
> format (that is what git-format-patch does), and it also is
> conceivable that diff-raw with diff-stat but without diff-patch
> might turn out to be useful for some people.

That sounds plausible. Note that if diff-stat and diff-patch are turned 
on, the patch generating code will be called twice. I do not think it is 
sensible (or robust, for that matter) to cache the patch for this case.

> Also, I forgot to mention, but would it be useful to have a
> diffstat to show --cc?  It is unclear, without much thinking,
> what the numbers would mean, though...

I thought long and hard about that. But how would you display it? You can 
have lines starting with "+ ", " +", "--", etc. The only half-way 
reasonable approach I found was to display the diffstat against each 
parent individually. Since it would be a bit involved to implement that, I 
wanted to think about it a bit longer, if it really makes sense.

Ciao,
Dscho

^ permalink raw reply

* Test fails on ubuntu breezy
From: Aneesh Kumar @ 2006-04-13  7:53 UTC (permalink / raw)
  To: Git Mailing List

kvaneesh@home:~/git-work/git.build/t$ ./t3600-rm.sh
Committing initial tree e5c556e46aae6124ff4a2a466c95004e92d9a2e4
*   ok 1: Pre-check that foo exists and is in index before git-rm foo
*   ok 2: Test that git-rm foo succeeds
*   ok 3: Post-check that foo exists but is not in index after git-rm foo
*   ok 4: Pre-check that bar exists and is in index before "git-rm -f bar"
*   ok 5: Test that "git-rm -f bar" succeeds
*   ok 6: Post-check that bar does not exist and is not in index after
"git-rm -f bar"
*   ok 7: Test that "git-rm -- -q" succeeds (remove a file that looks
like an option)
*   ok 8: Test that "git-rm -f" succeeds with embedded space, tab, or
newline characters.
* FAIL 9: Test that "git-rm -f" fails if its rm fails
        git-rm -f baz
*   ok 10: When the rm in "git-rm -f" fails, it should not remove the
file from the index
* failed 1 among 10 test(s)
kvaneesh@home:~/git-work/git.build/t$

-aneesh

^ permalink raw reply

* Re: [RFH] shifting xdiff hunks?
From: Jakub Narebski @ 2006-04-13  7:44 UTC (permalink / raw)
  To: git
In-Reply-To: <7vmzeqyolw.fsf@assigned-by-dhcp.cox.net>

Junio C. Hamano wrote:
 
> Now, from correctness point of view, this is not a problem at
> all, but I am wondering if xdiff can help to always shift the
> hunk down or up to consistently produce one way or another
> (personally I feel the former is easier to read).

This would also help with adding new functions, as sometimes diff begins
with the closing brace of the preceding function, instead of ending with
closing brace of the added function.

Just my own 0.2 eurocents.

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Johannes Schindelin @ 2006-04-13  6:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy7ya13e3.fsf@assigned-by-dhcp.cox.net>

Hi,

On Wed, 12 Apr 2006, Junio C Hamano wrote:

> By the way, I've been wondering if anybody uses the
> GIT_EXTERNAL_DIFF interface.  Does anybody miss it if we did so?

Yes. I use it regularly with a patched wdiff (word-by-word diff).

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Junio C Hamano @ 2006-04-13  6:53 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <7vy7ya13e3.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> writes:

> I wonder if you can also make this an independent option that
> prepends diffstat in front of the patch, just like the way the
> new flag --patch-with-raw flag prepends raw output in front of
> the patch.

Clarification.

Traditionally, we had diff-raw and diff-patch formats.
We can think of --name-status and --name-only variants of
diff-raw (just like different --abbrev settings give different
visuals for diff-raw).  Until very recently, these were either-or
output formats, but for Cogito we added an option to show both.

We could reorganize the output format options to:

	- diff-raw and its name variants
	- diff-stat
        - diff-patch

and have (internally) three bools to specify which ones to
output, in the above order.  The recent --patch-with-raw would
flip bit #0 (show raw) and bit #2 (show patch) on.  It is very
likely that diff-stat followed by diff-patch would be a popular
format (that is what git-format-patch does), and it also is
conceivable that diff-raw with diff-stat but without diff-patch
might turn out to be useful for some people.

Also, I forgot to mention, but would it be useful to have a
diffstat to show --cc?  It is unclear, without much thinking,
what the numbers would mean, though...

^ permalink raw reply

* Re: [RFH] shifting xdiff hunks?
From: Davide Libenzi @ 2006-04-13  6:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmzeqyolw.fsf@assigned-by-dhcp.cox.net>

On Wed, 12 Apr 2006, Junio C Hamano wrote:

> The first hunk begins by an addition of a couple of non-blank
> line followed by an addition of a blank line.  The second hunk,
> while it does the same thing, is shown differently.
>
> Now, from correctness point of view, this is not a problem at
> all, but I am wondering if xdiff can help to always shift the
> hunk down or up to consistently produce one way or another
> (personally I feel the former is easier to read).

Next on your screens, Junio and Linus in the new commedy "Pickier and Pickiest" :)



> Here is a rough sketch of what I think I want.  When we have
> additions, as long as the first line added happens to match the
> first line that is common between the versions that comes after
> the added hunk (that is, in the case of the second hunk above,
> the empty line before "gitlink:git-rm[1]" happens to match the
> empty line after the added three lines), roll the hunk down by
> one, until you cannot roll it down anymore.
>
> Just in case I get misinterpreted, I am not talking about
> treating empty lines in any special way.  It is more about
> "starting the hunk with actually changed line".  The first hunk
> above clearly begins with something added, while the second one
> does not.
>
> Is this something easy to do with the xdiff code?

Yes, this is what GNU diff does. It's a post-process of the edit script. 
Not a problem at all. Till this weekend (included) I'm pretty booked, but 
I'll do that in the following days.



- Davide

^ permalink raw reply

* [RFH] shifting xdiff hunks?
From: Junio C Hamano @ 2006-04-13  6:30 UTC (permalink / raw)
  To: Davide Libenzi; +Cc: git

I was looking at one diff produced from my work-in-progress,
which looked like this...

    diff --git a/Documentation/git.txt b/Documentation/git.txt
    index 06b2e53..f72abfc 100644
    --- a/Documentation/git.txt
    +++ b/Documentation/git.txt
    @@ -265,6 +265,9 @@ gitlink:git-checkout[1]::
     gitlink:git-cherry-pick[1]::
            Cherry-pick the effect of an existing commit.

    +gitlink:git-clean[1]::
    +       Remove untracked files from the working tree.
    +
     gitlink:git-clone[1]::
            Clones a repository into a new directory.

    @@ -318,6 +321,9 @@ gitlink:git-resolve[1]::

     gitlink:git-revert[1]::
            Revert an existing commit.
    +
    +gitlink:git-rm[1]::
    +       Remove files from the working tree and from the index.

     gitlink:git-shortlog[1]::
            Summarizes 'git log' output.

The first hunk begins by an addition of a couple of non-blank
line followed by an addition of a blank line.  The second hunk,
while it does the same thing, is shown differently.

Now, from correctness point of view, this is not a problem at
all, but I am wondering if xdiff can help to always shift the
hunk down or up to consistently produce one way or another
(personally I feel the former is easier to read).

Here is a rough sketch of what I think I want.  When we have
additions, as long as the first line added happens to match the
first line that is common between the versions that comes after
the added hunk (that is, in the case of the second hunk above,
the empty line before "gitlink:git-rm[1]" happens to match the
empty line after the added three lines), roll the hunk down by
one, until you cannot roll it down anymore.

Just in case I get misinterpreted, I am not talking about
treating empty lines in any special way.  It is more about
"starting the hunk with actually changed line".  The first hunk
above clearly begins with something added, while the second one
does not.

Is this something easy to do with the xdiff code?

^ permalink raw reply

* Re: how to make a git-format patch
From: Junio C Hamano @ 2006-04-13  5:53 UTC (permalink / raw)
  To: Aubrey; +Cc: git
In-Reply-To: <6d6a94c50604122236i47f3c2e9s7656118eda95a2cd@mail.gmail.com>

Aubrey <aubreylee@gmail.com> writes:

> git whatchanged -p didn't include the signoff and howmany lines
> changed which git-format-patch seems not include commit comments.
>
> Is there one command to merge the two kind of message?

I think you already guessed it, judging from the Subject: line,
but the command is called "git-format-patch", and was around for
a long time.

^ permalink raw reply

* Re: how to make a git-format patch
From: Aubrey @ 2006-04-13  5:36 UTC (permalink / raw)
  To: Mathieu Chouquet-Stringer; +Cc: git
In-Reply-To: <m3sloiriu7.fsf@localhost.localdomain>

On 12 Apr 2006 16:04:16 +0200, Mathieu Chouquet-Stringer
<ml2news@free.fr> wrote:
> I believe you're talking about 'git whatchanged -p' which not only displays
> the diffs but also the commit comments.

git whatchanged -p didn't include the signoff and howmany lines
changed which git-format-patch seems not include commit comments.

Is there one command to merge the two kind of message?

Thanks,
-Aubrey

^ permalink raw reply

* Re: Common option parsing..
From: Junio C Hamano @ 2006-04-13  5:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604121828370.14565@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> The easiest way to just solve all this mess would be to 
>  - add the diff-options into "struct rev_list" and make the 
>    "setup_revisions()" parser parse the diff flags too.
>  - get rid of "log_info" and "diff_options"
>  - possibly rename the resulting super-options structure as "struct 
>    git_options" or something if we want to.
>...
> What do you think?

I think it all makes sense.  And once this kind of clean-up is
done, I suspect the implementations of "git diff", "git log" and
"git show" would become quite similar -- one notable difference
being "git diff" with a single rev and "git show" with a single
rev would be quite different, but that is just how the arguments
are interpreted, not parsed.

However, I am not sure about the two-revs case.  I suspect the
incoming items are sorted in the revs->commits list, and we
wouldn't be able to tell which is src and which is dst when
setup_revisions() returns.

^ permalink raw reply

* Re: [PATCH] diff-options: add --stat
From: Junio C Hamano @ 2006-04-13  4:54 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0604130301240.28688@wbgn013.biozentrum.uni-wuerzburg.de>

Interesting.

I wonder if you can also make this an independent option that
prepends diffstat in front of the patch, just like the way the
new flag --patch-with-raw flag prepends raw output in front of
the patch.

By the way, I've been wondering if anybody uses the
GIT_EXTERNAL_DIFF interface.  Does anybody miss it if we did so?

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox