@@ -34,8 +34,8 @@ function initDevTools(repoName)
34
34
% parse the remoteRepoURL
35
35
sepIndices = strfind(gitConf .remoteRepoURL , ' /' );
36
36
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 );
39
39
40
40
% ignore case for the current fork (avoids problems for untracked files with case conflicts)
41
41
[status_gitIgnoreCase , result_gitIgnoreCase ] = system(' git config core.ignorecase true' );
@@ -47,11 +47,11 @@ function initDevTools(repoName)
47
47
if gitConf .printLevel > 0
48
48
originCall = [' [' , mfilename , ' ] ' ];
49
49
else
50
- originCall = ' ' ;
50
+ originCall = ' ' ;
51
51
end
52
52
53
53
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 ]);
55
55
else
56
56
printMsg(mfilename , ' The Github username could not be retrieved or is not valid.' , [gitCmd .fail , gitCmd .trail ]);
57
57
@@ -63,7 +63,7 @@ function initDevTools(repoName)
63
63
fprintf([gitCmd .lead , originCall , ' Your Github username is: ' , gitConf .userName , ' . ' , gitCmd .success , gitCmd .trail ]);
64
64
else
65
65
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 ]);
67
67
end
68
68
end
69
69
end
@@ -86,7 +86,7 @@ function initDevTools(repoName)
86
86
fprintf([gitCmd .lead , originCall , ' Your Github email is: ' , gitConf .userEmail , ' . ' , gitCmd .success , gitCmd .trail ]);
87
87
else
88
88
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 ]);
90
90
end
91
91
end
92
92
end
@@ -108,7 +108,7 @@ function initDevTools(repoName)
108
108
createDir = false ;
109
109
110
110
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' );
112
112
113
113
% define the local directory as the current directory if the reply is empty
114
114
if isempty(reply )
@@ -117,25 +117,25 @@ function initDevTools(repoName)
117
117
gitConf.localDir = reply ;
118
118
end
119
119
120
- % add a fileseparator if not included
121
- if ~strcmp(gitConf .localDir(end ), filesep )
122
- gitConf.localDir = strrep([gitConf .localDir , filesep ], ' \' , ' \\ ' );
123
- end
124
-
125
120
% strip the fork-nickName folder from the localDir if present
126
121
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 ));
129
124
end
130
125
end
131
126
127
+ % add a fileseparator if not included
128
+ if ~strcmp(gitConf .localDir(end ), filesep )
129
+ gitConf.localDir = strrep([gitConf .localDir , filesep ], ' \' , ' \\ ' );
130
+ end
131
+
132
132
% 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
134
134
printMsg(mfilename , [' The specified directory already contains a ' , gitConf .nickName , ' copy (clone).' ], gitCmd .trail );
135
135
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 ));
137
137
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
139
139
printMsg(mfilename , [' The specified directory already is a git repository (git-tracked).' ], gitCmd .trail );
140
140
141
141
else
@@ -154,7 +154,7 @@ function initDevTools(repoName)
154
154
system([' mkdir ' , gitConf .localDir ]);
155
155
printMsg(mfilename , ' The directory has been created.' );
156
156
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 ]);
158
158
end
159
159
end
160
160
end
@@ -167,7 +167,7 @@ function initDevTools(repoName)
167
167
fprintf([gitCmd .lead , originCall , ' Your fork directory has been set to: ' , gitConf .fullForkDir , ' . ' , gitCmd .success , gitCmd .trail ]);
168
168
else
169
169
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 ]);
171
171
end
172
172
173
173
% clone the fork
0 commit comments