Re: [PATCH 10/13] test-lib-functions: add and use a "write_hook" wrapper

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

 



On Mon, Dec 13 2021, Eric Sunshine wrote:

> On Sun, Dec 12, 2021 at 4:24 PM Ævar Arnfjörð Bjarmason
> <avarab@xxxxxxxxx> wrote:
>> Add a "write_hook" wrapper for the common case of "write_script
>> .git/hooks/<NAME>". This also accepts a "-C" option like
>> "test_commit". Let's convert various trivial cases of "write_script"
>> over to it.
>> [...]
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
>> ---
>> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
>> @@ -551,6 +551,32 @@ write_script () {
>> +## Usage: write-hook pre-receive
>> +## Usage: write-hook -C some-dir pre-receive
>> +write_hook () {
>> +       indir= &&
>> +       while test $# != 0
>> +       do
>
> It's not clear whether the intention is to maintain the &&-chain in
> this function...
>
>> +               case "$1" in
>> +               -C)
>> +                       indir="$2"
>> +                       shift
>> +                       ;;
>
> ... or not care about it since it's broken here before `shift`...
>
>> +               -*)
>> +                       BUG "invalid write_hook: $1"
>> +                       ;;
>> +               *)
>> +                       break
>> +                       ;;
>> +               esac &&
>> +               shift
>> +       done &&
>> +       git_dir=$(git -C "$indir" rev-parse --absolute-git-dir) &&
>> +       hook_dir="$git_dir/hooks" &&
>> +       hook_file="$hook_dir/$1"
>> +       write_script "$hook_file"
>
> ... and here before `write_script`.

Thanks, those should all use &&-chaining. Will fix.




[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]

  Powered by Linux