Re: [PATCH] Add tests to demonstrate update-index bug with core.symlinks/core.filemode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lists@xxxxxxxxxxxxxxxx (Stefan Haller) writes:

> 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).
 
> 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.

> +
> +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?

[...]
> +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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]