From: Junio C Hamano Date: Wed, 13 Feb 2008 23:25:11 GMT Subject: Re: [PATCH/selftest] hash-object: don't rely on order of --stdin, -w arguments Message-ID: <7v8x1oo2w8.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20080213224941.18121.qmail@c0fdbb95c1b5f1.315fe32.mid.smarden.org> Gerrit Pape writes: > Fix 'git hash-object --stdin -w' to actually write the object, just as > 'git hash-object -w --stdin' does. > > Reported by Josh Triplett through > http://bugs.debian.org/464432 > > Signed-off-by: Gerrit Pape Thanks. I think the patch itself is a good fix to the old design mistake we made. However, I would _really_ like to see something like the following mentioned in the proposed commit log message for discussion: This regresses the use case of running: $ git hash-object --stdin Makefile +test_expect_success \ > + 'git hash-object -w --stdin saves the object' \ > + 'echo foo | git hash-object -w --stdin && > + test -r .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 && > + rm -f .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99' I'd feel better if tests outside t0000 did not hardcode the actual values, like this: obname=$(echo foo | git hash-object -w --stdin) && ob=$(expr "$obname" : "\(..\)") && name=$(expr "$obname" : "..\(.*\)") && test -f ".git/objects/$ob/$name"