ref_transaction_commit(): use a string_list for detecting duplicates
commit07f9c881d6acef35b7dc8e5c783e63b1cac71084
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 11 May 2015 15:25:11 +0000 (11 17:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 May 2015 18:50:19 +0000 (11 11:50 -0700)
tree599efcdf2f975e1ca2dcb57603c7b12e97db5384
parent61da59699263afcbf8f1e3c66763237fe35ba670
ref_transaction_commit(): use a string_list for detecting duplicates

Detect duplicates by storing the reference names in a string_list and
sorting that, instead of sorting the ref_updates directly.

* In a moment the string_list will be used for another purpose, too.

* This removes the need for the custom comparison function
  ref_update_compare().

* This means that we can carry out the updates in the order that the
  user specified them instead of reordering them. This might be handy
  someday if, we want to permit multiple updates to a single reference
  as long as they are compatible with each other.

Note: we can't use string_list_remove_duplicates() to check for
duplicates, because we need to know the name of the reference that
appeared multiple times, to be used in the error message.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
refs.c