Re: [PATCH] git-credential-store: skip empty lines and comments from store

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

 



[Cc:+Dirk -- so he knows his bug report[1] wasn't ignored]

On Sun, Apr 26, 2020 at 7:48 PM Carlo Marcelo Arenas Belón
<carenas@xxxxxxxxx> wrote:
> with the added checks for invalid URLs in credentials, any locally
> modified store files which might have empty lines or even comments
> were reported as failing[1] to parse as valid credentials.
>
> instead of passing every line to the matcher as read, trim them
> from spaces and skip the ones that will be otherwise empty or
> start with "#" (assumed to be comments)
>
> Reported-by: Dirk <dirk@xxxxxxx>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
> ---
> diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh
> @@ -120,4 +120,21 @@ test_expect_success 'erase: erase matching credentials from both xdg and home fi
> +test_expect_success 'get: allow for empty lines or comments in store file' '
> +       echo "#this is a comment" >"$HOME/.git-credentials" &&
> +       echo "" >>"$HOME/.git-credentials" &&
> +       echo "https://user:pass@xxxxxxxxxxx"; >>"$HOME/.git-credentials" &&
> +       echo "    " >>"$HOME/.git-credentials" &&

Is there a reason you don't use a here-doc for the above (which would
be less noisy)? For instance:

    q_to_tab >"$HOME/.git-credentials" <<-\EOF &&
    #this is a comment

    https://user:pass@xxxxxxxxxxx
    Q
    EOF

[1]: https://lore.kernel.org/git/ad80aa0d-3a35-6d7e-7958-b3520e16c855@xxxxxxx/



[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