Re: [PATCH v2 13/27] t1400: Test that stdin -z update treats empty newvalue as zeros

2014-03-31 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes:

 This is the (slightly inconsistent) status quo; make sure it doesn't
 change by accident.

Interesting.  So oldvalue being empty is we do not care what it
is (as opposed to we know it must not exist yet aka 0{40}), and
newvalue being empty is the same as delete it aka 0{40}.

That is unfortunate, but I agree it is a good idea to add a test for
it, so that we will notice when we decide to fix it.


 Signed-off-by: Michael Haggerty mhag...@alum.mit.edu
 ---
  t/t1400-update-ref.sh | 7 +++
  1 file changed, 7 insertions(+)

 diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
 index a2015d0..208f56e 100755
 --- a/t/t1400-update-ref.sh
 +++ b/t/t1400-update-ref.sh
 @@ -730,6 +730,13 @@ test_expect_success 'stdin -z fails update with bad ref 
 name' '
   grep fatal: invalid ref format: ~a err
  '
  
 +test_expect_success 'stdin -z treats empty new value as zeros' '
 + git update-ref $a $m 
 + printf $F update $a   stdin 
 + git update-ref -z --stdin stdin 
 + test_must_fail git rev-parse --verify -q $a
 +'
 +
  test_expect_success 'stdin -z fails update with no new value' '
   printf $F update $a stdin 
   test_must_fail git update-ref -z --stdin stdin 2err 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 13/27] t1400: Test that stdin -z update treats empty newvalue as zeros

2014-03-31 Thread Michael Haggerty
On 03/31/2014 11:48 PM, Junio C Hamano wrote:
 Michael Haggerty mhag...@alum.mit.edu writes:
 
 This is the (slightly inconsistent) status quo; make sure it doesn't
 change by accident.
 
 Interesting.  So oldvalue being empty is we do not care what it
 is (as opposed to we know it must not exist yet aka 0{40}), and
 newvalue being empty is the same as delete it aka 0{40}.
 
 That is unfortunate, but I agree it is a good idea to add a test for
 it, so that we will notice when we decide to fix it.

Correct.  This was discussed at some more length here [1].  In v1 of
this patch series I incorrectly changed this behavior, thinking it to
have been an accident.

Michael

[1]
http://thread.gmane.org/gmane.comp.version-control.git/243731/focus=243773

-- 
Michael Haggerty
mhag...@alum.mit.edu
http://softwareswirl.blogspot.com/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html