Skip to content
  • CB Bailey's avatar
    stash: Don't overwrite files that have gone from the index · 7aa5d43c
    CB Bailey authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The use of git add -u in create_stash isn't always complete. In
    particular, if a file has been removed from the index but changed in the
    work tree it will not be added to the stash's saved work tree tree
    object. When stash then resets the work tree to match HEAD, any changes
    will be lost.
    
    To be complete, any work tree file which differs from HEAD needs to be
    saved, regardless of whether it still appears in the index or not.
    
    This is achieved with a combination of a diff against HEAD and a call to
    update-index with an explicit list of paths that have changed.
    
    Signed-off-by: default avatarCharles Bailey <charles@hashpling.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    7aa5d43c