git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: Derrick Stolee <stolee@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Stefan Beller <stefanbeller@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 07/15] t4011: abstract away SHA-1-specific constants
Date: Tue, 8 Oct 2019 19:40:12 +0000	[thread overview]
Message-ID: <20191008194012.4s35pbwbh25rblhb@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CAKPyHN3NaBv5s9aefb8fTDeGto2tLyTa0DxTjbWO9pGRY22pPQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1789 bytes --]

On 2019-10-08 at 12:33:43, Bert Wesarg wrote:
> On Tue, Oct 8, 2019 at 2:21 PM Derrick Stolee <stolee@gmail.com> wrote:
> >
> > On 10/5/2019 5:12 PM, brian m. carlson wrote:
> > > Adjust the test so that it computes variables for object IDs instead of
> > > using hard-coded hashes.
> >
> > [snip]
> >
> > > @@ -137,14 +141,17 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' '
> > >  '
> > >
> > >  test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' '
> > > -     cat >expect <<-\EOF &&
> > > +     file=$(git rev-parse --short $(git hash-object file.bin)) &&
> > > +     link=$(git rev-parse --short \
> > > +             $(printf file.bin | git hash-object --stdin)) &&
> >
> > Why this change from $(git hash-object file.bin) to
> > $(printf file.bin | git hash-object --stdin)?
> 
> thats two different things. The first hashes the content of file
> "file.bin". The second hashes the literal string "file.bin". To avoid
> this confusion, may I suggest to use 'printf "%s" "file.bin"', so that
> it is clear, that the literal string is meant in this context?

This is completely correct, and, yes, I can definitely make that change.
In fact, the fact that this is confusing probably means I should use a
suitably named shell function for this, so I'll make that change when I
reroll.

> > For that matter, why are you using the "printf|git hash-object"
> > pattern throughout your change? Seems like an unnecessary hurdle
> > to me.

I would normally use echo for these types of things (because that's our
style and it's more customary), but in this case the symlink contents
don't contain a newline, so printf is required.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

  parent reply	other threads:[~2019-10-08 19:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05 21:11 [PATCH 00/15] SHA-256 test fixes, part 6 brian m. carlson
2019-10-05 21:11 ` [PATCH 01/15] t/oid-info: allow looking up hash algorithm name brian m. carlson
2019-10-05 21:11 ` [PATCH 02/15] t/oid-info: add empty tree and empty blob values brian m. carlson
2019-10-05 21:11 ` [PATCH 03/15] rev-parse: add an --object-format option brian m. carlson
2019-10-08 11:51   ` Derrick Stolee
2019-10-08 19:31     ` brian m. carlson
2019-10-05 21:11 ` [PATCH 04/15] t1305: avoid comparing extensions brian m. carlson
2019-10-05 21:11 ` [PATCH 05/15] t3429: remove SHA1 annotation brian m. carlson
2019-10-05 21:12 ` [PATCH 06/15] t4010: abstract away SHA-1-specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 07/15] t4011: " brian m. carlson
2019-10-08 12:21   ` Derrick Stolee
2019-10-08 12:33     ` Bert Wesarg
2019-10-08 12:38       ` Derrick Stolee
2019-10-08 19:40       ` brian m. carlson [this message]
2019-10-05 21:12 ` [PATCH 08/15] t4015: " brian m. carlson
2019-10-08 12:31   ` Derrick Stolee
2019-10-05 21:12 ` [PATCH 09/15] t4027: make hash-size independent brian m. carlson
2019-10-05 21:12 ` [PATCH 10/15] t4034: abstract away SHA-1-specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 11/15] t4038: abstract away SHA-1 specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 12/15] t4039: abstract away SHA-1-specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 13/15] t4044: update test to work with SHA-256 brian m. carlson
2019-10-05 21:12 ` [PATCH 14/15] t4045: make hash-size independent brian m. carlson
2019-10-05 21:12 ` [PATCH 15/15] t4048: abstract away SHA-1-specific constants brian m. carlson
2019-10-08 12:40 ` [PATCH 00/15] SHA-256 test fixes, part 6 Derrick Stolee

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191008194012.4s35pbwbh25rblhb@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=stefanbeller@gmail.com \
    --cc=stolee@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).