Skip to content

Commit 96b3764

Browse files
Merge pull request #21 from opencobra/develop
Regular merge of develop
2 parents 19990fe + e735bd9 commit 96b3764

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/initDevTools.m

+19-19
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function initDevTools(repoName)
3434
% parse the remoteRepoURL
3535
sepIndices = strfind(gitConf.remoteRepoURL, '/');
3636
gitConf.remoteServerName = gitConf.remoteRepoURL(1:sepIndices(3));
37-
gitConf.remoteRepoName = gitConf.remoteRepoURL(sepIndices(4)+1:end-4);
38-
gitConf.remoteUserName = gitConf.remoteRepoURL(sepIndices(3)+1:sepIndices(4)-1);
37+
gitConf.remoteRepoName = gitConf.remoteRepoURL(sepIndices(4) + 1:end - 4);
38+
gitConf.remoteUserName = gitConf.remoteRepoURL(sepIndices(3) + 1:sepIndices(4) - 1);
3939

4040
% ignore case for the current fork (avoids problems for untracked files with case conflicts)
4141
[status_gitIgnoreCase, result_gitIgnoreCase] = system('git config core.ignorecase true');
@@ -47,11 +47,11 @@ function initDevTools(repoName)
4747
if gitConf.printLevel > 0
4848
originCall = [' [', mfilename, '] '];
4949
else
50-
originCall = '';
50+
originCall = '';
5151
end
5252

5353
if status_gitConfUserGet == 0 && isempty(strfind(gitConf.userName, ' '))
54-
fprintf([gitCmd.lead, originCall, 'Your Github username is: ', gitConf.userName, '. ', gitCmd.success, gitCmd.trail]); %
54+
fprintf([gitCmd.lead, originCall, 'Your Github username is: ', gitConf.userName, '. ', gitCmd.success, gitCmd.trail]);
5555
else
5656
printMsg(mfilename, 'The Github username could not be retrieved or is not valid.', [gitCmd.fail, gitCmd.trail]);
5757

@@ -63,7 +63,7 @@ function initDevTools(repoName)
6363
fprintf([gitCmd.lead, originCall, 'Your Github username is: ', gitConf.userName, '. ', gitCmd.success, gitCmd.trail]);
6464
else
6565
fprintf(result_gitConfUserSet);
66-
error([gitCmd.lead, ' [', mfilename,'] Your Github username could not be set.', gitCmd.fail]);
66+
error([gitCmd.lead, ' [', mfilename, '] Your Github username could not be set.', gitCmd.fail]);
6767
end
6868
end
6969
end
@@ -86,7 +86,7 @@ function initDevTools(repoName)
8686
fprintf([gitCmd.lead, originCall, 'Your Github email is: ', gitConf.userEmail, '. ', gitCmd.success, gitCmd.trail]);
8787
else
8888
fprintf(result_gitConfEmailSet);
89-
error([gitCmd.lead, ' [', mfilename,'] Your Github email could not be set.', gitCmd.fail]);
89+
error([gitCmd.lead, ' [', mfilename, '] Your Github email could not be set.', gitCmd.fail]);
9090
end
9191
end
9292
end
@@ -108,7 +108,7 @@ function initDevTools(repoName)
108108
createDir = false;
109109

110110
while ~createDir
111-
reply = input([gitCmd.lead, originCall, ' -> Please define the location of your fork\n current: ', strrep(pwd,'\','\\'),'\n Enter the path (press ENTER to use the current path): '], 's');
111+
reply = input([gitCmd.lead, originCall, ' -> Please define the location of your fork\n current: ', strrep(pwd, '\','\\'),'\n Enter the path(press ENTER to use the current path): '], 's');
112112

113113
% define the local directory as the current directory if the reply is empty
114114
if isempty(reply)
@@ -117,25 +117,25 @@ function initDevTools(repoName)
117117
gitConf.localDir = reply;
118118
end
119119

120-
% add a fileseparator if not included
121-
if ~strcmp(gitConf.localDir(end), filesep)
122-
gitConf.localDir = strrep([gitConf.localDir, filesep], '\', '\\');
123-
end
124-
125120
% strip the fork-nickName folder from the localDir if present
126121
if ~isempty(gitConf.localDir) && length(gitConf.forkDirName) <= length(gitConf.localDir)
127-
if strcmp(gitConf.localDir(end-length(gitConf.forkDirName)+1:end), gitConf.forkDirName)
128-
gitConf.localDir = gitConf.localDir(1:end-length(gitConf.forkDirName));
122+
if strcmp(gitConf.localDir(end - length(gitConf.forkDirName) + 1:end), gitConf.forkDirName)
123+
gitConf.localDir = gitConf.localDir(1:end - length(gitConf.forkDirName));
129124
end
130125
end
131126

127+
% add a fileseparator if not included
128+
if ~strcmp(gitConf.localDir(end), filesep)
129+
gitConf.localDir = strrep([gitConf.localDir, filesep], '\', '\\');
130+
end
131+
132132
% warn the user of not using a fork-nickName directory or a git cloned directory as it will be cloned
133-
if ~isempty(strfind(gitConf.localDir, gitConf.nickName)) % contains the nickname
133+
if ~isempty(strfind(gitConf.localDir, gitConf.nickName)) % contains the nickname
134134
printMsg(mfilename, ['The specified directory already contains a ', gitConf.nickName, ' copy (clone).'], gitCmd.trail);
135135
createDir = true;
136-
gitConf.localDir = gitConf.localDir(1:end-length(gitConf.nickName)-1-length(gitConf.leadForkDirName));
136+
gitConf.localDir = gitConf.localDir(1:end - length(gitConf.nickName) - 1 - length(gitConf.leadForkDirName));
137137

138-
elseif exist([gitConf.localDir, '/.git'], 'dir') == 7 % contains a .git folder
138+
elseif exist([gitConf.localDir filesep '.git'], 'dir') == 7 % contains a .git folder
139139
printMsg(mfilename, ['The specified directory already is a git repository (git-tracked).'], gitCmd.trail);
140140

141141
else
@@ -154,7 +154,7 @@ function initDevTools(repoName)
154154
system(['mkdir ', gitConf.localDir]);
155155
printMsg(mfilename, 'The directory has been created.');
156156
else
157-
error([gitCmd.lead, ' [', mfilename,'] The specified directory does not exist.', gitCmd.fail]);
157+
error([gitCmd.lead, ' [', mfilename, '] The specified directory does not exist.', gitCmd.fail]);
158158
end
159159
end
160160
end
@@ -167,7 +167,7 @@ function initDevTools(repoName)
167167
fprintf([gitCmd.lead, originCall, 'Your fork directory has been set to: ', gitConf.fullForkDir, '. ', gitCmd.success, gitCmd.trail]);
168168
else
169169
fprintf(result_gitConfForkDirSet);
170-
error([gitCmd.lead, ' [', mfilename,'] Your fork directory could not be set.', gitCmd.fail]);
170+
error([gitCmd.lead, ' [', mfilename, '] Your fork directory could not be set.', gitCmd.fail]);
171171
end
172172

173173
% clone the fork

0 commit comments

Comments
 (0)