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}"
cd "${VIM_SOURCE_DIR}"
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."
echo " Please remove it and try again."
exit 1
fi
cd "${VIM_SOURCE_DIR}"
echo "Updating Vim sources: ${VIM_SOURCE_DIR}"
git pull &&
msg_ok "Updated Vim sources." ||
@@ -202,7 +202,7 @@ get_vimpatch() {
cd "${NVIM_SOURCE_DIR}"
printf "Creating patch...\n"
printf "Creating patch...\n"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
printf "Pre-processing patch...\n"