vim-patch.sh: Use git-rev-parse to check repo (#8875)

Explicitly checking for the .git/ directory doesn't work in various
situations (e.g., git-worktree).

[ci skip]
This commit is contained in:
James McCoy 2018-08-20 11:41:00 -04:00 committed by Justin M. Keyes
parent 98632f1cce
commit c05d7153d3

View File

@ -85,12 +85,12 @@ get_vim_sources() {
git clone https://github.com/vim/vim.git "${VIM_SOURCE_DIR}" git clone https://github.com/vim/vim.git "${VIM_SOURCE_DIR}"
cd "${VIM_SOURCE_DIR}" cd "${VIM_SOURCE_DIR}"
else else
if [[ ! -d "${VIM_SOURCE_DIR}/.git" ]]; then cd "${VIM_SOURCE_DIR}"
if [[ "$(git rev-parse --show-toplevel)" != "${VIM_SOURCE_DIR}" ]]; then
msg_err "${VIM_SOURCE_DIR} does not appear to be a git repository." msg_err "${VIM_SOURCE_DIR} does not appear to be a git repository."
echo " Please remove it and try again." echo " Please remove it and try again."
exit 1 exit 1
fi fi
cd "${VIM_SOURCE_DIR}"
echo "Updating Vim sources: ${VIM_SOURCE_DIR}" echo "Updating Vim sources: ${VIM_SOURCE_DIR}"
git pull && git pull &&
msg_ok "Updated Vim sources." || msg_ok "Updated Vim sources." ||
@ -202,7 +202,7 @@ get_vimpatch() {
printf "Pre-processing patch...\n" printf "Pre-processing patch...\n"
preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}" preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}"
msg_ok "Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n" msg_ok "Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'."
} }
stage_patch() { stage_patch() {