All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Alberto Bertogli <albertito@gmail.com>,
	git@vger.kernel.org, gitster@pobox.com,
	Johan Herland <johan@herland.net>
Subject: Re: [PATCH 4/6] Add a test script for "git notes"
Date: Sun, 15 Jul 2007 22:11:30 -0700	[thread overview]
Message-ID: <7v3azp6igt.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Pine.LNX.4.64.0707160024060.14781@racer.site

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

> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> new file mode 100755
> index 0000000..eb50191
> --- /dev/null
> +++ b/t/t3301-notes.sh
> @@ -0,0 +1,63 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2007 Johannes E. Schindelin
> +#
> +
> +test_description='Test commit notes'
> +
> +. ./test-lib.sh
> +
> +test_expect_success setup '
> +	: > a1 &&
> +	git add a1 &&
> +	test_tick &&
> +	git commit -m 1st &&
> +	: > a2 &&
> +	git add a2 &&
> +	test_tick &&
> +	git commit -m 2nd
> +'

Does not test the failure mode of not having a HEAD yet.

> +cat > fake_editor.sh << EOF
> +echo "\$MSG" > "\$1"
> +echo "\$MSG" >& 2
> +EOF

You can avoid all these backslashes by saying:

	cat >fake_editor.sh <<\EOF
        echo "$MSG" >"$1"
        echo "$MSG" >&2
	EOF

> +chmod a+x fake_editor.sh
> +VISUAL="$(pwd)"/fake_editor.sh
> +export VISUAL

Not that it hurts anybody, but do you really need that $(pwd),
instead of "./fake_editor.sh"?

> +
> +test_expect_success 'need notes ref' '
> +	! MSG=1 git notes edit &&
> +	! MSG=2 git notes show
> +'
> +
> +test_expect_success 'create notes' '
> +	git config core.notesRef refs/notes/commits &&
> +	MSG=b1 git notes edit &&
> +cat .git/new-notes &&
> +test b1 = "$(cat .git/new-notes)" &&
> +	test 1 = $(git ls-tree refs/notes/commits | wc -l) &&
> +	test b1 = $(git notes show) &&
> +	git show HEAD^ &&
> +	! git notes show HEAD^
> +'

Is there particular reason for that (lack of) indentation for
the two lines among them?

I think it is a bug to leave ".git/new-notes" and friends
behind.

> +
> +cat > expect << EOF
> +commit 268048bfb8a1fb38e703baceb8ab235421bf80c5
> +Author: A U Thor <author@example.com>
> +Date:   Thu Apr 7 15:14:13 2005 -0700
> +
> +    2nd
> +
> +Notes:
> +    b1
> +EOF
> +
> +test_expect_success 'show notes' '
> +	! (git cat-file commit HEAD | grep b1) &&
> +	git log -1 > output &&
> +	git diff expect output
> +'
> +
> +test_done

Hmph.  This makes the reader wonder why this is not optional,
perhaps linked to --decorate option somehow.

  reply	other threads:[~2007-07-16  5:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-15 23:19 [PATCH 0/6] Introduce commit notes Johannes Schindelin
2007-07-15 23:22 ` [PATCH 1/6] Rename git_one_line() to git_line_length() and export it Johannes Schindelin
2007-07-15 23:23 ` [PATCH 2/6] Introduce commit notes Johannes Schindelin
2007-07-15 23:36   ` Junio C Hamano
2007-07-15 23:52     ` Johannes Schindelin
2007-07-16  0:05     ` Junio C Hamano
2007-07-16  5:11   ` Junio C Hamano
2007-07-19  2:30     ` [REVISED PATCH " Johannes Schindelin
2007-07-19  3:28       ` Linus Torvalds
2007-07-19  5:13         ` Junio C Hamano
2007-07-19  9:34           ` Junio C Hamano
2007-07-19  9:57             ` Adam Hayek
2007-07-19 10:58             ` Andy Parkins
2007-07-19 11:10               ` Johannes Schindelin
2007-07-19 14:33                 ` Andy Parkins
2007-07-19 17:42             ` Linus Torvalds
2007-07-20  0:20               ` Junio C Hamano
2007-07-20  4:59             ` Shawn O. Pearce
2007-07-19 17:20           ` Linus Torvalds
2007-07-19  9:50         ` Johannes Schindelin
2007-07-19 10:34         ` Olivier Galibert
2007-07-19 17:50           ` Linus Torvalds
2007-07-19  9:05       ` Wincent Colaiuta
2007-07-19  9:24         ` Johannes Schindelin
2007-07-19  9:54       ` Sven Verdoolaege
2007-07-15 23:23 ` [PATCH 3/6] Add git-notes Johannes Schindelin
2007-07-16  5:11   ` Junio C Hamano
2007-07-19  2:31     ` [REVISED PATCH " Johannes Schindelin
2007-07-19  2:54       ` Johannes Schindelin
2007-07-15 23:24 ` [PATCH 4/6] Add a test script for "git notes" Johannes Schindelin
2007-07-16  5:11   ` Junio C Hamano [this message]
2007-07-19  2:32     ` [REVISED PATCH " Johannes Schindelin
2007-07-15 23:24 ` [PATCH 5/6] Document git-notes Johannes Schindelin
2007-07-15 23:26 ` [WIP PATCH 6/6] notes: add notes-index for a substantial speedup Johannes Schindelin
2007-07-15 23:33   ` Johannes Schindelin
2007-07-16  6:01   ` Shawn O. Pearce
2007-07-16 16:29     ` Johannes Schindelin
2007-07-16  7:57 ` [PATCH 0/6] Introduce commit notes Andy Parkins
2007-07-16  8:11   ` Junio C Hamano
2007-07-16 16:26     ` Johannes Schindelin
2007-07-16 17:56       ` Junio C Hamano
2007-07-19  1:34         ` 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=7v3azp6igt.fsf@assigned-by-dhcp.cox.net \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=albertito@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    /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.