Skip to content

Commit 712c127

Browse files
committed
Cleanup: minor fixes.
* ScmSyncGitCheckInCommand: typo in a code path that is never taken in this plugin (it always calls checkIn with only a directory, no files). * Commit: check for user != null. Is that null check needed at all? * FixedGitStatusConsumer: use simpler & more efficient File.replace() instead of File.replaceAll(). File.separator is guaranteed to be the single character File.separatorChar per its contract.
1 parent 78a71d8 commit 712c127

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/java/hudson/plugins/scm_sync_configuration/model/Commit.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ private static String createCommitMessage(ScmContext context, String messagePref
4343
if (user != null) {
4444
commitMessage.append(user.getId()).append(": ");
4545
}
46-
commitMessage.append(messagePrefix);
47-
commitMessage.append("\n\n");
48-
commitMessage.append("Change performed by ").append(user.getDisplayName());
49-
commitMessage.append('\n');
46+
commitMessage.append(messagePrefix).append('\n');
47+
if (user != null) {
48+
commitMessage.append('\n').append("Change performed by ").append(user.getDisplayName()).append('\n');
49+
}
5050
if (userComment != null && !"".equals(userComment.trim())){
5151
commitMessage.append('\n').append(userComment.trim());
5252
}

src/main/java/hudson/plugins/scm_sync_configuration/scms/customproviders/git/gitexe/FixedGitStatusConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ else if ( ( matcher = RENAMED_PATTERN.matcher( line ) ).find() )
193193
}
194194

195195
for (String file : files) {
196-
changedFiles.add(new ScmFile(file.replaceAll(File.separator, "/"), status));
196+
changedFiles.add(new ScmFile(file.replace(File.separatorChar, '/'), status));
197197
}
198198
}
199199

src/main/java/hudson/plugins/scm_sync_configuration/scms/customproviders/git/gitexe/ScmSyncGitCheckInCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected CheckInScmResult executeCheckInCommand(
6767
ScmSyncGitAddCommand addCommand = new ScmSyncGitAddCommand();
6868
addCommand.setLogger(getLogger());
6969
AddScmResult addResult = addCommand.executeAddFileSet(fileSet);
70-
if (addResult != null && addResult.isSuccess()) {
70+
if (addResult != null && !addResult.isSuccess()) {
7171
return new CheckInScmResult(new ArrayList<ScmFile>(), addResult);
7272
}
7373
}

0 commit comments

Comments
 (0)