]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'mh/ref-transaction'
authorJunio C Hamano <gitster@pobox.com>
Tue, 3 Jun 2014 19:06:40 +0000 (12:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Jun 2014 19:06:41 +0000 (12:06 -0700)
Update "update-ref --stdin [-z]" and then introduce a transactional
support for (multi-)reference updates.

* mh/ref-transaction: (27 commits)
  ref_transaction_commit(): work with transaction->updates in place
  struct ref_update: add a type field
  struct ref_update: add a lock field
  ref_transaction_commit(): simplify code using temporary variables
  struct ref_update: store refname as a FLEX_ARRAY
  struct ref_update: rename field "ref_name" to "refname"
  refs: remove API function update_refs()
  update-ref --stdin: reimplement using reference transactions
  refs: add a concept of a reference transaction
  update-ref --stdin: harmonize error messages
  update-ref --stdin: improve the error message for unexpected EOF
  t1400: test one mistake at a time
  update-ref --stdin -z: deprecate interpreting the empty string as zeros
  update-ref.c: extract a new function, parse_next_sha1()
  t1400: test that stdin -z update treats empty <newvalue> as zeros
  update-ref --stdin: simplify error messages for missing oldvalues
  update-ref --stdin: make error messages more consistent
  update-ref --stdin: improve error messages for invalid values
  update-ref.c: extract a new function, parse_refname()
  parse_cmd_verify(): copy old_sha1 instead of evaluating <oldvalue> twice
  ...

1  2 
builtin/checkout.c
builtin/merge.c
builtin/notes.c
t/t1400-update-ref.sh

Simple merge
diff --cc builtin/merge.c
Simple merge
diff --cc builtin/notes.c
Simple merge
index e130c528fe5a0115c99b1203cfe9dced046cece3,48ccc4d6355c1f1a1de2080fafc31eb38836a400..4e2459afc549d5d2985024e8c23bf5fa117d570a
@@@ -820,21 -858,10 +858,21 @@@ test_expect_success 'stdin -z update re
        test_must_fail git rev-parse --verify -q $c
  '
  
 +test_expect_success 'stdin -z create ref fails when ref exists' '
 +      git update-ref $c $m &&
 +      git rev-parse "$c" >expect &&
 +      printf $F "create $c" "$m~1" >stdin &&
 +      test_must_fail git update-ref -z --stdin <stdin 2>err &&
 +      grep "fatal: Cannot lock the ref '"'"'$c'"'"'" err &&
 +      git rev-parse "$c" >actual &&
 +      test_cmp expect actual
 +'
 +
  test_expect_success 'stdin -z create ref fails with bad new value' '
 +      git update-ref -d "$c" &&
        printf $F "create $c" "does-not-exist" >stdin &&
        test_must_fail git update-ref -z --stdin <stdin 2>err &&
-       grep "fatal: invalid new value for ref $c: does-not-exist" err &&
+       grep "fatal: create $c: invalid <newvalue>: does-not-exist" err &&
        test_must_fail git rev-parse --verify -q $c
  '