Skip to content
  • Patrick Steinhardt's avatar
    git-stash: fix pushing stash with pathspec from subdir · 22fc703e
    Patrick Steinhardt authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The `git stash push` command recently gained the ability to get a
    pathspec as its argument to only stash matching files. Calling this
    command from a subdirectory does not work, though, as one of the first
    things we do is changing to the top level directory without keeping
    track of the prefix from which the command is being run.
    
    Fix the shortcoming by storing the prefix previous to the call to
    `cd_to_toplevel` and then subsequently using `git rev-parse --prefix` to
    correctly resolve the pathspec. Add a test to catch future breakage of
    this usecase.
    
    Signed-off-by: default avatarPatrick Steinhardt <ps@pks.im>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    22fc703e