From 7c8750cd0b43e34c1f728d6f9a4a7975933f0a5e Mon Sep 17 00:00:00 2001 From: Pavlo Havrylyuk <12107961+pavlohav@users.noreply.github.com> Date: Wed, 31 Jan 2024 01:30:07 +0000 Subject: [PATCH] Fix support for folders with space --- diffGitHub_pullrequest.m | 4 ++-- diffGitHub_push.m | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/diffGitHub_pullrequest.m b/diffGitHub_pullrequest.m index ff43c8a..3262794 100644 --- a/diffGitHub_pullrequest.m +++ b/diffGitHub_pullrequest.m @@ -8,7 +8,7 @@ function diffGitHub_pullrequest(branchname) gitCommand = sprintf('git --no-pager diff --name-only refs/remotes/origin/main..refs/remotes/origin/%s ***.slx', branchname); [status,modifiedFiles] = system(gitCommand); assert(status==0, modifiedFiles); - modifiedFiles = split(modifiedFiles); + modifiedFiles = splitlines(modifiedFiles); modifiedFiles(end) = []; % Removing last element because it is empty if isempty(modifiedFiles) @@ -57,7 +57,7 @@ function diffGitHub_pullrequest(branchname) ancestor = strrep(sprintf('%s%s%s',ancestor, "_ancestor", ext), '\', '/'); % Build git command to get ancestor from main % git show refs/remotes/origin/main:models/modelname.slx > modelscopy/modelname_ancestor.slx - gitCommand = sprintf('git --no-pager show refs/remotes/origin/main:%s > %s', fileName, ancestor); + gitCommand = sprintf('git --no-pager show refs/remotes/origin/main:\"%s\" > \"%s\"', fileName, ancestor); [status, result] = system(gitCommand); assert(status==0, result); diff --git a/diffGitHub_push.m b/diffGitHub_push.m index a6bcf28..2c53d6c 100644 --- a/diffGitHub_push.m +++ b/diffGitHub_push.m @@ -8,7 +8,7 @@ function diffGitHub_push(lastpush) gitCommand = sprintf('git --no-pager diff --name-only %s ***.slx', lastpush); [status,modifiedFiles] = system(gitCommand); assert(status==0, modifiedFiles); - modifiedFiles = split(modifiedFiles); + modifiedFiles = splitlines(modifiedFiles); modifiedFiles(end) = []; % Removing last element because it is empty if isempty(modifiedFiles) @@ -56,7 +56,7 @@ function diffGitHub_push(lastpush) % Build git command to get ancestor % git show lastpush:models/modelname.slx > modelscopy/modelname_ancestor.slx - gitCommand = sprintf('git --no-pager show %s:%s > %s', lastpush, fileName, ancestor); + gitCommand = sprintf('git --no-pager show %s:\"%s\" > \"%s\"', lastpush, fileName, ancestor); [status, result] = system(gitCommand); assert(status==0, result);