* [PATCH v6 3/7] tests: paint skipped tests in bold blue
From: Adam Spiers @ 2012-12-16 18:28 UTC (permalink / raw)
To: git list
In-Reply-To: <1355682495-22382-1-git-send-email-git@adamspiers.org>
Skipped tests indicate incomplete test coverage. Whilst this is not a
test failure or other error, it's still not a complete success.
Other testsuite related software like automake, autotest and prove
seem to use blue for skipped tests, so let's follow suit.
Signed-off-by: Adam Spiers <git@adamspiers.org>
---
t/test-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 710f051..220b172 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -212,7 +212,7 @@ then
error)
tput bold; tput setaf 1;; # bold red
skip)
- tput bold; tput setaf 2;; # bold green
+ tput bold; tput setaf 4;; # bold blue
warn)
tput bold; tput setaf 3;; # bold brown/yellow
pass)
--
1.7.12.1.396.g53b3ea9
^ permalink raw reply related
* [PATCH v6 2/7] tests: paint known breakages in bold yellow
From: Adam Spiers @ 2012-12-16 18:28 UTC (permalink / raw)
To: git list
In-Reply-To: <1355682495-22382-1-git-send-email-git@adamspiers.org>
Bold yellow seems a more appropriate color than bold green when
considering the universal traffic lights coloring scheme, where
green conveys the impression that everything's OK, and amber that
something's not quite right.
Likewise, change the color of the summarized total number of known
breakages from bold red to bold yellow to be less alarmist and more
consistent with the above.
Signed-off-by: Adam Spiers <git@adamspiers.org>
---
t/test-lib.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index d0b236f..710f051 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -213,6 +213,8 @@ then
tput bold; tput setaf 1;; # bold red
skip)
tput bold; tput setaf 2;; # bold green
+ warn)
+ tput bold; tput setaf 3;; # bold brown/yellow
pass)
tput setaf 2;; # green
info)
@@ -311,7 +313,7 @@ test_known_broken_ok_ () {
test_known_broken_failure_ () {
test_broken=$(($test_broken+1))
- say_color skip "not ok $test_count - $@ # TODO known breakage"
+ say_color warn "not ok $test_count - $@ # TODO known breakage"
}
test_debug () {
@@ -408,7 +410,7 @@ test_done () {
fi
if test "$test_broken" != 0
then
- say_color error "# still have $test_broken known breakage(s)"
+ say_color warn "# still have $test_broken known breakage(s)"
msg="remaining $(($test_count-$test_broken)) test(s)"
else
msg="$test_count test(s)"
--
1.7.12.1.396.g53b3ea9
^ permalink raw reply related
* [PATCH v6 4/7] tests: change info messages from yellow/brown to bold cyan
From: Adam Spiers @ 2012-12-16 18:28 UTC (permalink / raw)
To: git list
In-Reply-To: <1355682495-22382-1-git-send-email-git@adamspiers.org>
Now that we've adopted a "traffic lights" coloring scheme, yellow is
used for warning messages, so we need to re-color info messages to
something less alarmist. Blue is a universal color for informational
messages; however we are using that for skipped tests in order to
align with the color schemes of other test suites. Therefore we use
bold cyan which is also blue-ish, but visually distinct from bold
blue. This was suggested on the list a while ago and no-one raised
any objections:
http://thread.gmane.org/gmane.comp.version-control.git/205675/focus=205966
Signed-off-by: Adam Spiers <git@adamspiers.org>
---
t/test-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 220b172..5d9d0fc 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -218,7 +218,7 @@ then
pass)
tput setaf 2;; # green
info)
- tput setaf 3;; # brown
+ tput bold; tput setaf 6;; # bold cyan
*)
test -n "$quiet" && return;;
esac
--
1.7.12.1.396.g53b3ea9
^ permalink raw reply related
* [PATCH v6 5/7] tests: refactor mechanics of testing in a sub test-lib
From: Adam Spiers @ 2012-12-16 18:28 UTC (permalink / raw)
To: git list
In-Reply-To: <1355682495-22382-1-git-send-email-git@adamspiers.org>
This will allow us to test the test framework more thoroughly
without disrupting the top-level test metrics.
Signed-off-by: Adam Spiers <git@adamspiers.org>
---
t/t0000-basic.sh | 85 ++++++++++++++++++++++++++------------------------------
1 file changed, 40 insertions(+), 45 deletions(-)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 46ccda3..fc5200f 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -45,39 +45,53 @@ test_expect_failure 'pretend we have a known breakage' '
false
'
-test_expect_success 'pretend we have fixed a known breakage (run in sub test-lib)' "
- mkdir passing-todo &&
- (cd passing-todo &&
- cat >passing-todo.sh <<-EOF &&
- #!$SHELL_PATH
-
- test_description='A passing TODO test
-
- This is run in a sub test-lib so that we do not get incorrect
- passing metrics
- '
-
- # Point to the t/test-lib.sh, which isn't in ../ as usual
- TEST_DIRECTORY=\"$TEST_DIRECTORY\"
- . \"\$TEST_DIRECTORY\"/test-lib.sh
+run_sub_test_lib_test () {
+ name="$1" descr="$2" # stdin is the body of the test code
+ mkdir $name &&
+ (
+ cd $name &&
+ cat >$name.sh <<-EOF &&
+ #!$SHELL_PATH
+
+ test_description='$descr (run in sub test-lib)
+
+ This is run in a sub test-lib so that we do not get incorrect
+ passing metrics
+ '
+
+ # Point to the t/test-lib.sh, which isn't in ../ as usual
+ . "\$TEST_DIRECTORY"/test-lib.sh
+ EOF
+ cat >>$name.sh &&
+ chmod +x $name.sh &&
+ export TEST_DIRECTORY &&
+ ./$name.sh >out 2>err
+ )
+}
- test_expect_failure 'pretend we have fixed a known breakage' '
- :
- '
+check_sub_test_lib_test () {
+ name="$1" # stdin is the expected output from the test
+ (
+ cd $name &&
+ ! test -s err &&
+ sed -e 's/^> //' -e 's/Z$//' >expect &&
+ test_cmp expect out
+ )
+}
+test_expect_success 'pretend we have fixed a known breakage' "
+ run_sub_test_lib_test passing-todo 'A passing TODO test' <<-\\EOF &&
+ test_expect_failure 'pretend we have fixed a known breakage' 'true'
test_done
EOF
- chmod +x passing-todo.sh &&
- ./passing-todo.sh >out 2>err &&
- ! test -s err &&
- sed -e 's/^> //' >expect <<-\\EOF &&
+ check_sub_test_lib_test passing-todo <<-\\EOF
> ok 1 - pretend we have fixed a known breakage # TODO known breakage
> # fixed 1 known breakage(s)
> # passed all 1 test(s)
> 1..1
EOF
- test_cmp expect out)
"
+
test_set_prereq HAVEIT
haveit=no
test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '
@@ -159,19 +173,8 @@ then
fi
test_expect_success 'tests clean up even on failures' "
- mkdir failing-cleanup &&
- (
- cd failing-cleanup &&
-
- cat >failing-cleanup.sh <<-EOF &&
- #!$SHELL_PATH
-
- test_description='Failing tests with cleanup commands'
-
- # Point to the t/test-lib.sh, which isn't in ../ as usual
- TEST_DIRECTORY=\"$TEST_DIRECTORY\"
- . \"\$TEST_DIRECTORY\"/test-lib.sh
-
+ test_must_fail run_sub_test_lib_test \
+ failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF &&
test_expect_success 'tests clean up even after a failure' '
touch clean-after-failure &&
test_when_finished rm clean-after-failure &&
@@ -181,14 +184,8 @@ test_expect_success 'tests clean up even on failures' "
test_when_finished \"(exit 2)\"
'
test_done
-
EOF
-
- chmod +x failing-cleanup.sh &&
- test_must_fail ./failing-cleanup.sh >out 2>err &&
- ! test -s err &&
- ! test -f \"trash directory.failing-cleanup/clean-after-failure\" &&
- sed -e 's/Z$//' -e 's/^> //' >expect <<-\\EOF &&
+ check_sub_test_lib_test failing-cleanup <<-\\EOF
> not ok 1 - tests clean up even after a failure
> # Z
> # touch clean-after-failure &&
@@ -202,8 +199,6 @@ test_expect_success 'tests clean up even on failures' "
> # failed 2 among 2 test(s)
> 1..2
EOF
- test_cmp expect out
- )
"
################################################################
--
1.7.12.1.396.g53b3ea9
^ permalink raw reply related
* Prebuilt man pages on Google code
From: John Keeping @ 2012-12-16 16:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
While investigating Asciidoc's quoting in this thread [1], I noticed
that my system man pages don't display Asciidoc double quoted text
correctly.
[1] http://article.gmane.org/gmane.comp.version-control.git/211533
For example in git-fast-import(1):
Here <name> is the person’s display name (for example `Com M Itter'')
and `<email> is the person’s email address (`cm@example.com''). `LT
and GT are the literal less-than (\x3c) and greater-than (\x3e)
symbols.
It turns out that Gentoo installs the man pages from git-core on Google
code, and the error can be seen in the "source" there [2].
[2] http://code.google.com/p/git-manpages/source/browse/man1/git-fast-import.1#379
When I generate man pages here, I get paired quotes (\u201C and \u201D):
Here <name> is the person’s display name (for example “Com M Itter”)
and <email> is the person’s email address (“cm@example.com”). LT and
GT are the literal less-than (\x3c) and greater-than (\x3e) symbol
I can't see any configuration option that could cause this difference,
so I assume it must be caused by some particular tool version on the
machine used to generate these man pages.
If the output is a side-effect of avoiding non-ASCII characters, is is
useful to do something like this (with appropriate Makefile support)?
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index 1273a85..6655ec7 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -89,6 +89,16 @@ template::[header-declarations]
endif::backend-docbook[]
endif::doctype-manpage[]
+ifdef::doctype-manpage[]
+ifdef::git-asciidoc-man-ascii[]
+[attributes]
+lsquo='
+rsquo='
+ldquo="
+rdquo="
+endif::git-asciidoc-man-ascii[]
+endif::doctype-manpage[]
+
ifdef::backend-xhtml11[]
[attributes]
git-relative-html-prefix=
^ permalink raw reply related
* [PATCH v2] Documentation: don't link to example mail addresses
From: John Keeping @ 2012-12-16 14:00 UTC (permalink / raw)
To: Jeff King; +Cc: git, Junio C Hamano
In-Reply-To: <20121216120405.GA14320@sigill.intra.peff.net>
Email addresses in documentation are converted into mailto: hyperlinks
in the HTML output and footnotes in man pages. This isn't desirable for
cases where the address is used as an example and is not valid.
Particularly annoying is the example "jane@laptop.(none)" which appears
in git-shortlog(1) as "jane@laptop[1].(none)", with note 1 saying:
1. jane@laptop
mailto:jane@laptop
Fix this by escaping these email addresses with a leading backslash, to
prevent Asciidoc expanding them as inline macros.
In the case of mailmap.txt, render the address monospaced so that it
matches the block examples surrounding that paragraph.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Keeping <john@keeping.me.uk>
---
On Sun, Dec 16, 2012 at 07:04:05AM -0500, Jeff King wrote:
> Furthermore, the right way to suppress
> expansion of macros is with a backslash escape.
[snipped an example]
> I think it's a little less ugly
> than the "$$" quoting, but not by much. No clue if one is accepted by
> more asciidoc versions or not.
>From a quick reading of the Asciidoc changelog, I think backslash
escaping should be supported just as well as "$$" quoting, which leaves
the minimal patch looking like this.
Documentation/git-fast-import.txt | 2 +-
Documentation/git-tag.txt | 2 +-
Documentation/mailmap.txt | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index d1844ea..68bca1a 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -427,7 +427,7 @@ they made it.
Here `<name>` is the person's display name (for example
``Com M Itter'') and `<email>` is the person's email address
-(``cm@example.com''). `LT` and `GT` are the literal less-than (\x3c)
+(``\cm@example.com''). `LT` and `GT` are the literal less-than (\x3c)
and greater-than (\x3e) symbols. These are required to delimit
the email address from the other fields in the line. Note that
`<name>` and `<email>` are free-form and may contain any sequence
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 247534e..2f1c0c3 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -129,7 +129,7 @@ This option is only applicable when listing tags without annotation lines.
CONFIGURATION
-------------
By default, 'git tag' in sign-with-default mode (-s) will use your
-committer identity (of the form "Your Name <your@email.address>") to
+committer identity (of the form "Your Name <\your@email.address>") to
find a key. If you want to use a different default key, you can specify
it in the repository configuration as follows:
diff --git a/Documentation/mailmap.txt b/Documentation/mailmap.txt
index 288f04e..dd89fca 100644
--- a/Documentation/mailmap.txt
+++ b/Documentation/mailmap.txt
@@ -46,7 +46,7 @@ Jane Doe <jane@desktop.(none)>
Joe R. Developer <joe@example.com>
------------
-Note how there is no need for an entry for <jane@laptop.(none)>, because the
+Note how there is no need for an entry for `<jane@laptop.(none)>`, because the
real name of that author is already correct.
Example 2: Your repository contains commits from the following
--
1.8.0.2
^ permalink raw reply related
* [PATCH] Move api-command.txt to the end of API list in api-index.txt
From: Thomas Ackermann @ 2012-12-16 12:23 UTC (permalink / raw)
To: th.acker, git
In-Reply-To: <1582223824.296627.1355560147565.JavaMail.ngmail@webmail08.arcor-online.net>
- because it describes a different form of API than the other api-* documents
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
---
Documentation/technical/api-index.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Documentation/technical/api-index.sh b/Documentation/technical/api-index.sh
index 9c3f413..c2c68ed 100755
--- a/Documentation/technical/api-index.sh
+++ b/Documentation/technical/api-index.sh
@@ -10,12 +10,16 @@
while read filename
do
case "$filename" in
- api-index-skel.txt | api-index.txt) continue ;;
+ api-index-skel.txt | api-index.txt | api-command.txt) continue ;;
esac
title=$(sed -e 1q "$filename")
html=${filename%.txt}.html
echo "* link:$html[$title]"
done
+ filename=api-command.txt
+ title=$(sed -e 1q "$filename")
+ html=${filename%.txt}.html
+ echo "* link:$html[$title]"
echo "$c"
sed -n -e '/^\/\/ table of contents end/,$p' "$skel"
) >api-index.txt+
--
1.8.0.msysgit.0
---
Thomas
^ permalink raw reply related
* Re: [PATCH] Documentation: don't link to example mail addresses
From: Jeff King @ 2012-12-16 12:04 UTC (permalink / raw)
To: John Keeping; +Cc: git, Junio C Hamano
In-Reply-To: <20121215182408.GD2725@river.lan>
On Sat, Dec 15, 2012 at 06:24:09PM +0000, John Keeping wrote:
> > I think I'd just render them monospace everywhere. We are very
> > inconsistent about which form of quotes we use in the documentation (I
> > think because most of the developers read the source directly and not
> > the rendered asciidoc). And then we don't have to worry about the "$$"
> > construct (and IMHO it makes the source much more readable, and marking
> > the address as a literal looks good in the output, too).
>
> I agree that the source is more readable as monospaced, but I think we
> need to keep the quotes around the text in git-tag(1) and probably
> git-fast-import(1) so that it is differentiated from the surrounding
> text in the man page output.
Hmm, good point. I use MAN_BOLD_LITERAL, which serves that purpose, but
I guess not everyone does (and it is not the default; I wonder if it
should be). But if MAN_BOLD_LITERAL is not in use, then `` literals
have zero typographical impact in the manpages.
So maybe we do need to do something else. I was just hoping we could get
away with something more readable in the source.
By my reading of the asciidoc user guide, the mechanism that is hurting
us is that mailto is an inline macro, and that foo@bar automatically
triggers that inline macro. Furthermore, the right way to suppress
expansion of macros is with a backslash escape. Doing this:
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index d1844ea..68bca1a 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -427,7 +427,7 @@ Here `<name>` is the person's display name (for example
Here `<name>` is the person's display name (for example
``Com M Itter'') and `<email>` is the person's email address
-(``cm@example.com''). `LT` and `GT` are the literal less-than (\x3c)
+(``\cm@example.com''). `LT` and `GT` are the literal less-than (\x3c)
and greater-than (\x3e) symbols. These are required to delimit
the email address from the other fields in the line. Note that
`<name>` and `<email>` are free-form and may contain any sequence
seems to produce the output we want. I think it's a little less ugly
than the "$$" quoting, but not by much. No clue if one is accepted by
more asciidoc versions or not.
-Peff
^ permalink raw reply related
* Re: [PATCH v4 3/4] cache-tree: fix writing cache-tree when CE_REMOVE is present
From: Junio C Hamano @ 2012-12-16 10:38 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <CACsJy8DgwQ2jn=tPpE8f22JNE1Vih86d=Xf1iGBznLcwMukd+w@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
>On Sun, Dec 16, 2012 at 2:20 PM, Junio C Hamano <gitster@pobox.com>
>wrote:
>> Nicely explained. I wonder if we can also add a piece of test to
>> the patch 4/4 to demonstrate the issue with CE_REMOVE entries,
>> though.
>
>A hand crafted one, maybe. I did not attempt to recreate it with git
>commands (and I don't think we update cache-tree after unpack_trees).
Yeah, that's what I thought. No need to bother creating a bug that won't appear in the real life :-)
Tusks for sanity checking.
--
Pardon terseness, typo and HTML from a tablet.
^ permalink raw reply
* Re: [PATCH v4 3/4] cache-tree: fix writing cache-tree when CE_REMOVE is present
From: Nguyen Thai Ngoc Duy @ 2012-12-16 10:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk3siqx8b.fsf@alter.siamese.dyndns.org>
On Sun, Dec 16, 2012 at 2:20 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> entry_count is used in update_one() for two purposes:
>>
>> 1. to skip through the number of processed entries in in-memory index
>> 2. to record the number of entries this cache-tree covers on disk
>>
>> Unfortunately when CE_REMOVE is present these numbers are not the same
>> because CE_REMOVE entries are automatically removed before writing to
>> disk but entry_count is not adjusted and still counts CE_REMOVE
>> entries.
>
> Nicely explained. I wonder if we can also add a piece of test to
> the patch 4/4 to demonstrate the issue with CE_REMOVE entries,
> though.
A hand crafted one, maybe. I did not attempt to recreate it with git
commands (and I don't think we update cache-tree after unpack_trees).
So I wrote something like this instead:
int main(int ac, char **av)
{
unsigned char sha1[20];
setup_git_directory();
read_cache();
active_cache[1]->ce_flags |= CE_REMOVE;
write_cache_as_tree(sha1, 0, NULL);
return 0;
}
I can polish it a bit and write new tests based on it and
test-dump-cache-tree if you want.
--
Duy
^ permalink raw reply
* Re: [PATCH] Remove misleading date form api-index-skel.txt
From: Andreas Schwab @ 2012-12-16 8:47 UTC (permalink / raw)
To: Thomas Ackermann; +Cc: git
In-Reply-To: <38388978.118261.1355647369577.JavaMail.ngmail@webmail21.arcor-online.net>
s/form/from/
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply
* [PATCH] Remove misleading date form api-index-skel.txt
From: Thomas Ackermann @ 2012-12-16 8:42 UTC (permalink / raw)
To: git
In-Reply-To: <1582223824.296627.1355560147565.JavaMail.ngmail@webmail08.arcor-online.net>
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
---
Documentation/technical/api-index-skel.txt | 2 --
1 file changed, 2 deletions(-)
diff --git a/Documentation/technical/api-index-skel.txt b/Documentation/technical/api-index-skel.txt
index af7cc2e..730cfac 100644
--- a/Documentation/technical/api-index-skel.txt
+++ b/Documentation/technical/api-index-skel.txt
@@ -11,5 +11,3 @@ documents them.
////////////////////////////////////////////////////////////////
// table of contents end
////////////////////////////////////////////////////////////////
-
-2007-11-24
--
1.8.0.msysgit.0
---
Thomas
^ permalink raw reply related
* Re: [PATCH 2/2] Port to QNX
From: Joachim Schmitz @ 2012-12-16 8:27 UTC (permalink / raw)
To: git
In-Reply-To: <1355510300-31541-3-git-send-email-kraai@ftbfs.org>
Matt Kraai wrote:
> From: Matt Kraai <matt.kraai@amo.abbott.com>
>
> Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
> ---
> Makefile | 19 +++++++++++++++++++
> git-compat-util.h | 8 ++++++--
> 2 files changed, 25 insertions(+), 2 deletions(-)
>
snip
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 2e79b8a..6c588ca 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -75,7 +75,7 @@
> # endif
> #elif !defined(__APPLE__) && !defined(__FreeBSD__) &&
> !defined(__USLC__) && \ !defined(_M_UNIX) && !defined(__sgi) &&
> !defined(__DragonFly__) && \ - !defined(__TANDEM)
> + !defined(__TANDEM) && !defined(__QNX__)
> #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD
> needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX
> 5.3L needs this */ #endif
> @@ -99,7 +99,7 @@
> #include <stdlib.h>
> #include <stdarg.h>
> #include <string.h>
> -#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
> +#if defined(__TANDEM) || defined(__QNX__) /* or HAVE_STRINGS_H or
> !NO_STRINGS_H? */ #include <strings.h> /* for strcasecmp() */
There's another recent thread, discussing to change this to "#ifdef
HAVE_STRING_H" plus the infrastructure in Makefile and configure.ac.
Bye, Jojo
^ permalink raw reply
* Re: [PATCH] git.c: add --index-file command-line option.
From: Manlio Perillo @ 2012-12-16 8:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvcc2r0z8.fsf@alter.siamese.dyndns.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 16/12/2012 06:59, Junio C Hamano ha scritto:
> I
> Manlio Perillo <manlio.perillo@gmail.com> writes:
>
>> This works with a shell.
>> I'm using Python to write a custom git command.
>
> I would be very surprised if Python lacked a way to spawn a
> subprocess with an environment modified from the current process.
Of course it is possible, but a command-line option is more convenient,
IMHO.
Regards Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlDNhGsACgkQscQJ24LbaUQ0dQCglUAw8zwRKNeDUGznfrm1xFKf
GQsAnA/ucztku4v9LnIr0Lv/gyl5ULiT
=j/1w
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [PATCH v4 3/4] cache-tree: fix writing cache-tree when CE_REMOVE is present
From: Junio C Hamano @ 2012-12-16 7:20 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1355631328-26678-4-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> entry_count is used in update_one() for two purposes:
>
> 1. to skip through the number of processed entries in in-memory index
> 2. to record the number of entries this cache-tree covers on disk
>
> Unfortunately when CE_REMOVE is present these numbers are not the same
> because CE_REMOVE entries are automatically removed before writing to
> disk but entry_count is not adjusted and still counts CE_REMOVE
> entries.
Nicely explained. I wonder if we can also add a piece of test to
the patch 4/4 to demonstrate the issue with CE_REMOVE entries,
though.
Thanks.
^ permalink raw reply
* Re: [PATCH 1/1] tests: Allow customization of how say_color() prints
From: Junio C Hamano @ 2012-12-16 6:34 UTC (permalink / raw)
To: Ramsay Jones; +Cc: GIT Mailing-list
In-Reply-To: <50CCCB86.5080701@ramsay1.demon.co.uk>
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index f50f834..9dcf3c1 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -202,6 +202,15 @@ do
> esac
> done
>
> +if test -z "$GIT_TEST_PRINT"
> +then
> + GIT_TEST_PRINT="printf %s"
> +fi
> +if test -z "$GIT_TEST_PRINT_LN"
> +then
> + GIT_TEST_PRINT_LN="printf %s\n"
> +fi
> +
> if test -n "$color"
> then
> say_color () {
> @@ -221,7 +230,7 @@ then
> test -n "$quiet" && return;;
> esac
> shift
> - printf "%s" "$*"
> + $GIT_TEST_PRINT "$*"
> tput sgr0
> echo
> )
> @@ -230,7 +239,7 @@ else
> say_color() {
> test -z "$1" && test -n "$quiet" && return
> shift
> - printf "%s\n" "$*"
> + $GIT_TEST_PRINT_LN "$*"
> }
> fi
As you said, this is ugly and also unwieldy in that I do not see an
easy way for a platform/builder to define something that needs to
pass a parameter with $IFS in it in these two variables.
Why does your printf die in the first place???
^ permalink raw reply
* Re: [PATCH] git.c: add --index-file command-line option.
From: Junio C Hamano @ 2012-12-16 5:59 UTC (permalink / raw)
To: Manlio Perillo; +Cc: git
In-Reply-To: <50CCF324.5060802@gmail.com>
I
Manlio Perillo <manlio.perillo@gmail.com> writes:
> This works with a shell.
> I'm using Python to write a custom git command.
I would be very surprised if Python lacked a way to spawn a
subprocess with an environment modified from the current process.
^ permalink raw reply
* Re: [PATCH] t3070: Disable some failing fnmatch tests
From: Nguyen Thai Ngoc Duy @ 2012-12-16 4:31 UTC (permalink / raw)
To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list
In-Reply-To: <50CCCD36.9020001@ramsay1.demon.co.uk>
On Sun, Dec 16, 2012 at 2:19 AM, Ramsay Jones
<ramsay@ramsay1.demon.co.uk> wrote:
>
> The failing tests make use of a POSIX character class, '[:xdigit:]'
> in this case, which some versions of the fnmatch() library function
> do not support. In the spirit of commit f1cf7b79 ("t3070: disable
> unreliable fnmatch tests", 15-10-2012), we disable the fnmatch() half
> of these tests.
I have no problem with this. You're on cygwin, right?
--
Duy
^ permalink raw reply
* [PATCH v4 4/4] cache-tree: invalidate i-t-a paths after generating trees
From: Nguyễn Thái Ngọc Duy @ 2012-12-16 4:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
In-Reply-To: <1355631328-26678-1-git-send-email-pclouds@gmail.com>
Intent-to-add entries used to forbid writing trees so it was not a
problem. After commit 3f6d56d (commit: ignore intent-to-add entries
instead of refusing - 2012-02-07), we can generate trees from an index
with i-t-a entries.
However, the commit forgets to invalidate all paths leading to i-t-a
entries. With fully valid cache-tree (e.g. after commit or
write-tree), diff operations may prefer cache-tree to index and not
see i-t-a entries in the index, because cache-tree does not have them.
Reported-by: Jonathon Mah <me@JonathonMah.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
cache-tree.c | 14 ++++++++++++--
t/t2203-add-intent.sh | 20 ++++++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index 2c10b2e..37e4d00 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -244,6 +244,7 @@ static int update_one(struct cache_tree *it,
struct strbuf buffer;
int missing_ok = flags & WRITE_TREE_MISSING_OK;
int dryrun = flags & WRITE_TREE_DRY_RUN;
+ int to_invalidate = 0;
int i;
*skip_count = 0;
@@ -333,6 +334,8 @@ static int update_one(struct cache_tree *it,
i += sub->count;
sha1 = sub->cache_tree->sha1;
mode = S_IFDIR;
+ if (sub->cache_tree->entry_count < 0)
+ to_invalidate = 1;
}
else {
sha1 = ce->sha1;
@@ -356,8 +359,15 @@ static int update_one(struct cache_tree *it,
continue;
}
- if (ce->ce_flags & CE_INTENT_TO_ADD)
+ /*
+ * CE_INTENT_TO_ADD entries exist on on-disk index but
+ * they are not part of generated trees. Invalidate up
+ * to root to force cache-tree users to read elsewhere.
+ */
+ if (ce->ce_flags & CE_INTENT_TO_ADD) {
+ to_invalidate = 1;
continue;
+ }
strbuf_grow(&buffer, entlen + 100);
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
@@ -377,7 +387,7 @@ static int update_one(struct cache_tree *it,
}
strbuf_release(&buffer);
- it->entry_count = i - *skip_count;
+ it->entry_count = to_invalidate ? -1 : i - *skip_count;
#if DEBUG
fprintf(stderr, "cache-tree update-one (%d ent, %d subtree) %s\n",
it->entry_count, it->subtree_nr,
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index ec35409..2a4a749 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -62,5 +62,25 @@ test_expect_success 'can "commit -a" with an i-t-a entry' '
git commit -a -m all
'
+test_expect_success 'cache-tree invalidates i-t-a paths' '
+ git reset --hard &&
+ mkdir dir &&
+ : >dir/foo &&
+ git add dir/foo &&
+ git commit -m foo &&
+
+ : >dir/bar &&
+ git add -N dir/bar &&
+ git diff --cached --name-only >actual &&
+ echo dir/bar >expect &&
+ test_cmp expect actual &&
+
+ git write-tree >/dev/null &&
+
+ git diff --cached --name-only >actual &&
+ echo dir/bar >expect &&
+ test_cmp expect actual
+'
+
test_done
--
1.8.0.rc2.23.g1fb49df
^ permalink raw reply related
* [PATCH v4 3/4] cache-tree: fix writing cache-tree when CE_REMOVE is present
From: Nguyễn Thái Ngọc Duy @ 2012-12-16 4:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
In-Reply-To: <1355631328-26678-1-git-send-email-pclouds@gmail.com>
entry_count is used in update_one() for two purposes:
1. to skip through the number of processed entries in in-memory index
2. to record the number of entries this cache-tree covers on disk
Unfortunately when CE_REMOVE is present these numbers are not the same
because CE_REMOVE entries are automatically removed before writing to
disk but entry_count is not adjusted and still counts CE_REMOVE
entries.
Separate the two use cases into two different variables. #1 is taken
care by the new field count in struct cache_tree_sub and entry_count
is prepared for #2.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
cache-tree.c | 30 +++++++++++++++++++++++-------
cache-tree.h | 1 +
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index 44eed28..2c10b2e 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -238,6 +238,7 @@ static int update_one(struct cache_tree *it,
int entries,
const char *base,
int baselen,
+ int *skip_count,
int flags)
{
struct strbuf buffer;
@@ -245,6 +246,8 @@ static int update_one(struct cache_tree *it,
int dryrun = flags & WRITE_TREE_DRY_RUN;
int i;
+ *skip_count = 0;
+
if (0 <= it->entry_count && has_sha1_file(it->sha1))
return it->entry_count;
@@ -264,7 +267,7 @@ static int update_one(struct cache_tree *it,
struct cache_entry *ce = cache[i];
struct cache_tree_sub *sub;
const char *path, *slash;
- int pathlen, sublen, subcnt;
+ int pathlen, sublen, subcnt, subskip;
path = ce->name;
pathlen = ce_namelen(ce);
@@ -289,10 +292,13 @@ static int update_one(struct cache_tree *it,
cache + i, entries - i,
path,
baselen + sublen + 1,
+ &subskip,
flags);
if (subcnt < 0)
return subcnt;
i += subcnt;
+ sub->count = subcnt; /* to be used in the next loop */
+ *skip_count += subskip;
sub->used = 1;
}
@@ -324,7 +330,7 @@ static int update_one(struct cache_tree *it,
if (!sub)
die("cache-tree.c: '%.*s' in '%s' not found",
entlen, path + baselen, path);
- i += sub->cache_tree->entry_count;
+ i += sub->count;
sha1 = sub->cache_tree->sha1;
mode = S_IFDIR;
}
@@ -340,8 +346,18 @@ static int update_one(struct cache_tree *it,
mode, sha1_to_hex(sha1), entlen+baselen, path);
}
- if (ce->ce_flags & (CE_REMOVE | CE_INTENT_TO_ADD))
- continue; /* entry being removed or placeholder */
+ /*
+ * CE_REMOVE entries are removed before the index is
+ * written to disk. Skip them to remain consistent
+ * with the future on-disk index.
+ */
+ if (ce->ce_flags & CE_REMOVE) {
+ *skip_count = *skip_count + 1;
+ continue;
+ }
+
+ if (ce->ce_flags & CE_INTENT_TO_ADD)
+ continue;
strbuf_grow(&buffer, entlen + 100);
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
@@ -361,7 +377,7 @@ static int update_one(struct cache_tree *it,
}
strbuf_release(&buffer);
- it->entry_count = i;
+ it->entry_count = i - *skip_count;
#if DEBUG
fprintf(stderr, "cache-tree update-one (%d ent, %d subtree) %s\n",
it->entry_count, it->subtree_nr,
@@ -375,11 +391,11 @@ int cache_tree_update(struct cache_tree *it,
int entries,
int flags)
{
- int i;
+ int i, skip;
i = verify_cache(cache, entries, flags);
if (i)
return i;
- i = update_one(it, cache, entries, "", 0, flags);
+ i = update_one(it, cache, entries, "", 0, &skip, flags);
if (i < 0)
return i;
return 0;
diff --git a/cache-tree.h b/cache-tree.h
index d8cb2e9..55d0f59 100644
--- a/cache-tree.h
+++ b/cache-tree.h
@@ -7,6 +7,7 @@
struct cache_tree;
struct cache_tree_sub {
struct cache_tree *cache_tree;
+ int count; /* internally used by update_one() */
int namelen;
int used;
char name[FLEX_ARRAY];
--
1.8.0.rc2.23.g1fb49df
^ permalink raw reply related
* [PATCH v4 2/4] cache-tree: replace "for" loops in update_one with "while" loops
From: Nguyễn Thái Ngọc Duy @ 2012-12-16 4:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
In-Reply-To: <1355631328-26678-1-git-send-email-pclouds@gmail.com>
The loops in update_one can be increased in two different ways: step
by one for files and by <n> for directories. "for" loop is not
suitable for this as it always steps by one and special handling is
required for directories. Replace them with "while" loops for clarity.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
cache-tree.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index e2beab5..44eed28 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -259,7 +259,8 @@ static int update_one(struct cache_tree *it,
/*
* Find the subtrees and update them.
*/
- for (i = 0; i < entries; i++) {
+ i = 0;
+ while (i < entries) {
struct cache_entry *ce = cache[i];
struct cache_tree_sub *sub;
const char *path, *slash;
@@ -271,8 +272,10 @@ static int update_one(struct cache_tree *it,
break; /* at the end of this level */
slash = strchr(path + baselen, '/');
- if (!slash)
+ if (!slash) {
+ i++;
continue;
+ }
/*
* a/bbb/c (base = a/, slash = /c)
* ==>
@@ -289,7 +292,7 @@ static int update_one(struct cache_tree *it,
flags);
if (subcnt < 0)
return subcnt;
- i += subcnt - 1;
+ i += subcnt;
sub->used = 1;
}
@@ -300,7 +303,8 @@ static int update_one(struct cache_tree *it,
*/
strbuf_init(&buffer, 8192);
- for (i = 0; i < entries; i++) {
+ i = 0;
+ while (i < entries) {
struct cache_entry *ce = cache[i];
struct cache_tree_sub *sub;
const char *path, *slash;
@@ -320,7 +324,7 @@ static int update_one(struct cache_tree *it,
if (!sub)
die("cache-tree.c: '%.*s' in '%s' not found",
entlen, path + baselen, path);
- i += sub->cache_tree->entry_count - 1;
+ i += sub->cache_tree->entry_count;
sha1 = sub->cache_tree->sha1;
mode = S_IFDIR;
}
@@ -328,6 +332,7 @@ static int update_one(struct cache_tree *it,
sha1 = ce->sha1;
mode = ce->ce_mode;
entlen = pathlen - baselen;
+ i++;
}
if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1)) {
strbuf_release(&buffer);
--
1.8.0.rc2.23.g1fb49df
^ permalink raw reply related
* [PATCH v4 0/4] nd/invalidate-i-t-a-cache-tree
From: Nguyễn Thái Ngọc Duy @ 2012-12-16 4:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
This version also fixes the CE_REMOVE bug I mentioned. As a side
effect, the bug fix makes the i-t-a fix cleaner.
Nguyễn Thái Ngọc Duy (4):
cache-tree: remove dead i-t-a code in verify_cache()
cache-tree: replace "for" loops in update_one with "while" loops
cache-tree: fix writing cache-tree when CE_REMOVE is present
cache-tree: invalidate i-t-a paths after generating trees
cache-tree.c | 61 +++++++++++++++++++++++++++++++++++++--------------
cache-tree.h | 1 +
t/t2203-add-intent.sh | 20 +++++++++++++++++
3 files changed, 65 insertions(+), 17 deletions(-)
--
1.8.0.rc2.23.g1fb49df
^ permalink raw reply
* [PATCH v4 1/4] cache-tree: remove dead i-t-a code in verify_cache()
From: Nguyễn Thái Ngọc Duy @ 2012-12-16 4:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
In-Reply-To: <1355631328-26678-1-git-send-email-pclouds@gmail.com>
This code is added in 331fcb5 (git add --intent-to-add: do not let an
empty blob be committed by accident - 2008-11-28) to forbid committing
when i-t-a entries are present. When we allow that, we forgot to
remove this.
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
cache-tree.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index 28ed657..e2beab5 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -166,12 +166,8 @@ static int verify_cache(struct cache_entry **cache,
fprintf(stderr, "...\n");
break;
}
- if (ce_stage(ce))
- fprintf(stderr, "%s: unmerged (%s)\n",
- ce->name, sha1_to_hex(ce->sha1));
- else
- fprintf(stderr, "%s: not added yet\n",
- ce->name);
+ fprintf(stderr, "%s: unmerged (%s)\n",
+ ce->name, sha1_to_hex(ce->sha1));
}
}
if (funny)
--
1.8.0.rc2.23.g1fb49df
^ permalink raw reply related
* Re: [PATCH 0/2] Port to QNX
From: Matt Kraai @ 2012-12-15 21:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy5gzrwih.fsf@alter.siamese.dyndns.org>
On Sat, Dec 15, 2012 at 10:38:30AM -0800, Junio C Hamano wrote:
> I do not mind queuing this on 'pu' but do you want to see your
> ftbfs.org address in the commit objects, or the other one that you
> are not using to interact with us?
Great! I'd prefer to use the amo.abbott.com address in the commit
objects, since that's where I did the work. I'm using this email
address because it doesn't require figuring out how to send proper
emails via Outlook and/or Exchange.
--
Matt
^ permalink raw reply
* Re: [PATCH] git.c: add --index-file command-line option.
From: Manlio Perillo @ 2012-12-15 22:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vliczrttq.fsf@alter.siamese.dyndns.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 15/12/2012 20:36, Junio C Hamano ha scritto:
> [...]
>>>> Unlike other environment variables (e.g. GIT_WORK_TREE,
>>>> GIT_NAMESPACE), it was not possible to set the GIT_INDEX_FILE
>>>> environment variable using the command line.
>>>
>>> Is this necessary? I'd prefer to see a better reason than "just
>>> because others have it".
>>
>> A long running program will be able to tell git to use an alternate
>> index file, without having to modify its own environment,...
>
> Hrm, isn't that the single-shot environment export syntax
>
> GIT_INDEX_FILE=foo git blah
>
> is for? Is there a real-world need for this?
>
This works with a shell.
I'm using Python to write a custom git command.
Regards Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlDM8yQACgkQscQJ24LbaUTftQCbBC7D9P7Sqlr9GzWuCIcIHPf2
aQcAn13+d4trLZS4izGvZtoaopMav4nV
=vfb6
-----END PGP SIGNATURE-----
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox