Re: [PATCH] Add tests to demonstrate update-index bug with core.symlinks/core.filemode
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Oct 24, 2010, 23:41 UTC
- Message-ID
- <m37hh7jh17.fsf@localhost.localdomain>
- In-Reply-To
- <1jqvbx3.1icsj8j1jf26lfM%lists@haller-berlin.de>
lists@haller-berlin.de (Stefan Haller) writes:
Show 10 quoted lines
> This is the first time I write a git test, so please point out anything > I might have done wrong. Also, I still don't have much of an idea how or > where to fix the problem, so any guidance towards that is much > appreciated. > > t/t2107-update-index-executable-bit-merged.sh | 44 +++++++++++++++++++++++++ > t/t2108-update-index-symlink-merged.sh | 43 ++++++++++++++++++++++++ > 2 files changed, 87 insertions(+), 0 deletions(-) > create mode 100755 t/t2107-update-index-executable-bit-merged.sh > create mode 100755 t/t2108-update-index-symlink-merged.sh
I guess that because those two tests are conceptually about the same thing, namely errors in git-update-index handling permissions which cannot be represented on filesystem (core.filemode and/or core.symlinks is false).
Show 15 quoted lines
> diff --git a/t/t2107-update-index-executable-bit-merged.sh b/t/t2107-update-index-executable-bit-merged.sh > new file mode 100755 > index 0000000..7a8f740 > --- /dev/null > +++ b/t/t2107-update-index-executable-bit-merged.sh > @@ -0,0 +1,44 @@ > +#!/bin/sh > +# > +# Copyright (c) 2010 Stefan Haller > +# > + > +test_description='git update-index on filesystem w/o symlinks test. > + > +This tests that git update-index keeps the executable bit when staging > +an unmerged file after a merge if core.filemode is false.'
All right.
> + > +. ./test-lib.sh
All right.
Show 8 quoted lines
> + > +test_expect_success \ > +'preparation' ' > +git config core.filemode false && > +touch foo && > +git add foo && > +git update-index --chmod=+x foo && > +git commit -m "Create"'
The suggested way of coding in test script looks like the following:
+test_expect_success 'preparation' ' + git config core.filemode false && + >foo && + git add foo && + git update-index --chmod=+x foo && + git commit -m "Create" +'
BTW. does it matter that 'foo' is empty?
[...]
Show 6 quoted lines
> +test_expect_failure \ > +'check that filemode is still 100755' ' > +case "`git ls-files --stage --cached -- foo`" in > +"100755 "*foo) echo pass;; > +*) echo fail; git ls-files --stage --cached -- foo; (exit 1);; > +esac'
Wouldn't it be better to simply prepare expected output (perhaps with stubs for hashes), and compare actual with expected output?
Also, weren't you able to use test_tick, test_commit, test_merge functions from test-lib.sh?
-- Jakub Narebski Poland ShadeHawk on #git