From fbfffe5ccc847a12eeb6afb9a440fc123d3483d9 Mon Sep 17 00:00:00 2001 From: wangyueliang Date: Wed, 5 Jun 2024 17:34:15 +0800 Subject: [PATCH] Fix the issue of using absolute path init and report directory is not empty --- src/cmd-init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd-init b/src/cmd-init index 9d9c38b2..0e2546c0 100755 --- a/src/cmd-init +++ b/src/cmd-init @@ -139,15 +139,15 @@ if [ $# -ne 1 ]; then fatal "ERROR: Missing GITCONFIG" fi +source=$1; shift +subdir=${1:-} + # If the current working dir is not empty then error out # unless force provided -if [ "$FORCE" != "1" ] && [ -n "$(ls ./)" ]; then +if [[ ${source} != /* ]] && [ "$FORCE" != "1" ] && [ -n "$(ls ./)" ]; then fatal "init: current directory is not empty, override with --force" fi -source=$1; shift -subdir=${1:-} - preflight if has_privileges; then -- Gitee