Skip to content
  • Ramkumar Ramachandra's avatar
    sha1_name: fix error message for @{<N>}, @{<date>} · 305ebea0
    Ramkumar Ramachandra authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Currently, when we try to resolve @{<N>} or @{<date>} when the reflog
    doesn't go back far enough, we get errors like:
    
      # on branch master
      $ git show @{10000}
      fatal: Log for '' only has 7 entries.
    
      $ git show @{10000.days.ago}
      warning: Log for '' only goes back to Tue, 21 May 2013 14:14:45 +0530.
      ...
    
      # detached HEAD case
      $ git show @{10000}
      fatal: Log for '' only has 2005 entries.
    
      $ git show master@{10000}
      fatal: Log for 'master' only has 7 entries.
    
    The empty string '' is confusing and does not convey information
    about whose logs we are inspecting.  Change this so that we get:
    
      # on branch master
      $ git show @{10000}
      fatal: Log for 'master' only has 7 entries.
    
      $ git show @{10000.days.ago}
      warning: Log for 'master' only goes back to Tue, 21 May 2013 14:14:45 +0530.
      ...
    
      # detached HEAD case
      $ git show @{10000}
      fatal: Log for 'HEAD' only has 2005 entries.
    
      $ git show master@{10000}
      fatal: Log for 'master' only has 7 entries.
    
    Also one of the message strings given to die() now points into
    real_ref that was not used in that fashion, so stop freeing the
    underlying storage for it.
    
    Signed-off-by: default avatarRamkumar Ramachandra <artagnon@gmail.com>
    Bug-spotted-and-fixed-by: Thomas Rast
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    305ebea0