Skip to content
  • Duy Nguyen's avatar
    get_sha1: warn about full or short object names that look like refs · 798c35fc
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When we get 40 hex digits, we immediately assume it's an SHA-1. This
    is the right thing to do because we have no way else to specify an
    object. If there is a ref with the same object name, it will be
    ignored. Warn the user about this case because the ref with full
    object name is likely a mistake, for example
    
        git checkout -b $empty_var $(git rev-parse something)
    
    advice.object_name_warning is not documented because frankly people
    should not be aware about it until they encounter this situation.
    
    While at there, warn about ambiguation with abbreviated SHA-1 too.
    
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    798c35fc