File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -319,13 +319,16 @@ function(git_add_remote)
319
319
320
320
find_program (GIT_EXECUTABLE "git" REQUIRED )
321
321
322
- # ensure that the given repository's remote is the current remote
322
+ # Get the list of the remotes
323
323
execute_process (
324
324
COMMAND "${GIT_EXECUTABLE} " "remote" "-v" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH} "
325
325
COMMAND_ERROR_IS_FATAL LAST
326
326
OUTPUT_VARIABLE _remote_output
327
327
)
328
- string (FIND "${_remote_output} " "${_fun_REMOTE_URL} " _find_index )
328
+ # Remove .git from the URL
329
+ string (REGEX REPLACE "^(.*)\. git$" "\\ 1" _fun_REMOTE_URL_no_git "${_fun_REMOTE_URL} " )
330
+ # Check if the given remote already exists in the remote list
331
+ string (FIND "${_remote_output} " "${_fun_REMOTE_URL_no_git} " _find_index )
329
332
330
333
# Add the given remote if it doesn't exist
331
334
if (${_find_index} EQUAL -1 )
You can’t perform that action at this time.
0 commit comments