Skip to content
  • Jeff King's avatar
    clone: leave repo in place after checkout errors · d3b34622
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    If we manage to clone a remote repository but run into an
    error in the checkout, it is probably sane to leave the repo
    directory in place. That lets the user examine the situation
    without spending time to re-clone from the remote (which may
    be a lengthy process).
    
    Rather than try to convert each die() from the checkout code
    path into an error(), we simply set a flag that tells the
    "remove_junk" atexit function to print a helpful message and
    leave the repo in place.
    
    Note that the test added in this patch actually passes
    without the code change. The reason is that the cleanup code
    is buggy; we chdir into the working tree for the checkout,
    but still may use relative paths to remove the directories
    (which means if you cloned into "foo", we would accidentally
    remove "foo" from the working tree!).  There's no point in
    fixing it now, since this patch means we will never try to
    remove anything after the chdir, anyway.
    
    [jc: replaced the message with a more succinct version from
    Jonathan]
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    d3b34622