Merge branch 'mh/submodule-hash'
authorJunio C Hamano <gitster@pobox.com>
Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)
Code and design clean-up for the refs API.

* mh/submodule-hash:
read_loose_refs(): read refs using resolve_ref_recursively()
files_ref_store::submodule: use NULL for the main repository
base_ref_store_init(): remove submodule argument
refs: push the submodule attribute down
refs: store submodule ref stores in a hashmap
register_ref_store(): new function
refs: remove some unnecessary handling of submodule == ""
refs: make some ref_store lookup functions private
refs: reorder some function definitions

1  2 
refs.c
refs/files-backend.c
refs/refs-internal.h
diff --cc refs.c
Simple merge
index 21e116d4e620b9de77def18bf89054399477cf62,cdb6b8ff572a41d8a10cbc7a49bfa64dffe045ee..db3bd42a91d1935471a93e3149165705ec55f8ec
@@@ -2007,11 -2015,13 +2022,11 @@@ static struct ref_lock *lock_ref_sha1_b
        struct strbuf ref_file = STRBUF_INIT;
        struct ref_lock *lock;
        int last_errno = 0;
 -      int lflags = LOCK_NO_DEREF;
        int mustexist = (old_sha1 && !is_null_sha1(old_sha1));
        int resolve_flags = RESOLVE_REF_NO_RECURSE;
 -      int attempts_remaining = 3;
        int resolved;
  
-       assert_main_repository(&refs->base, "lock_ref_sha1_basic");
+       files_assert_main_repository(refs, "lock_ref_sha1_basic");
        assert(err);
  
        lock = xcalloc(1, sizeof(struct ref_lock));
@@@ -2902,11 -2945,10 +2917,11 @@@ static int commit_ref_update(struct fil
                             const unsigned char *sha1, const char *logmsg,
                             struct strbuf *err)
  {
-       assert_main_repository(&refs->base, "commit_ref_update");
+       files_assert_main_repository(refs, "commit_ref_update");
  
        clear_loose_ref_cache(refs);
 -      if (log_ref_write(lock->ref_name, lock->old_oid.hash, sha1, logmsg, 0, err)) {
 +      if (files_log_ref_write(lock->ref_name, lock->old_oid.hash, sha1,
 +                              logmsg, 0, err)) {
                char *old_msg = strbuf_detach(err, NULL);
                strbuf_addf(err, "cannot update the ref '%s': %s",
                            lock->ref_name, old_msg);
Simple merge