Skip to content
  • brian m. carlson's avatar
    sha1_name: convert get_sha1* to get_oid* · e82caf38
    brian m. carlson authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Now that all the callers of get_sha1 directly or indirectly use struct
    object_id, rename the functions starting with get_sha1 to start with
    get_oid.  Convert the internals in sha1_name.c to use struct object_id
    as well, and eliminate explicit length checks where possible.  Convert a
    use of 40 in get_oid_basic to GIT_SHA1_HEXSZ.
    
    Outside of sha1_name.c and cache.h, this transition was made with the
    following semantic patch:
    
    @@
    expression E1, E2;
    @@
    - get_sha1(E1, E2.hash)
    + get_oid(E1, &E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1(E1, E2->hash)
    + get_oid(E1, E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_committish(E1, E2.hash)
    + get_oid_committish(E1, &E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_committish(E1, E2->hash)
    + get_oid_committish(E1, E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_treeish(E1, E2.hash)
    + get_oid_treeish(E1, &E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_treeish(E1, E2->hash)
    + get_oid_treeish(E1, E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_commit(E1, E2.hash)
    + get_oid_commit(E1, &E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_commit(E1, E2->hash)
    + get_oid_commit(E1, E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_tree(E1, E2.hash)
    + get_oid_tree(E1, &E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_tree(E1, E2->hash)
    + get_oid_tree(E1, E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_blob(E1, E2.hash)
    + get_oid_blob(E1, &E2)
    
    @@
    expression E1, E2;
    @@
    - get_sha1_blob(E1, E2->hash)
    + get_oid_blob(E1, E2)
    
    @@
    expression E1, E2, E3, E4;
    @@
    - get_sha1_with_context(E1, E2, E3.hash, E4)
    + get_oid_with_context(E1, E2, &E3, E4)
    
    @@
    expression E1, E2, E3, E4;
    @@
    - get_sha1_with_context(E1, E2, E3->hash, E4)
    + get_oid_with_context(E1, E2, E3, E4)
    
    Signed-off-by: default avatarbrian m. carlson <sandals@crustytoothpaste.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    e82caf38