Skip to content

Commit

Permalink
Fix minorr bugs
Browse files Browse the repository at this point in the history
Commit deleted file when it was replaced in git
Fix commit functionality in tfs
Change git-branch to git-rev-parse because git-branch displays all remote branches
  • Loading branch information
rugpanov committed Aug 28, 2017
1 parent 7dfde35 commit e31bde6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/bll/remoterun/cvsproviderfactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ export class CvsSupportProviderFactory {
if (gitIsActive) {
Logger.logDebug(`CvsSupportProviderFactory#getCvsSupportProvider: git is an activeCvs`);
const gitProvider = new GitSupportProvider(gitCvsInfo.path);
await gitProvider.init();
try {
await gitProvider.init();
} catch (err) {
throw new Error("(teamcity) An error occurred during gitProvider initialisation");
}
cvsProviders.push(gitProvider);
}

Expand Down
5 changes: 4 additions & 1 deletion src/dal/gitprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class GitSupportProvider implements CvsSupportProvider {
* This method uses the "git branch -vv" command
*/
private async getRemoteBrunch(): Promise<string> {
const getRemoteBranchCommand: string = `"${this._gitPath}" -C "${this._workspaceRootPath}" branch -vv --format='%(upstream:short)'`;
const getRemoteBranchCommand: string = `"${this._gitPath}" -C "${this._workspaceRootPath}" rev-parse --abbrev-ref --symbolic-full-name @{u}`;
const prom = await cp_promise.exec(getRemoteBranchCommand);
let remoteBranch: string = prom.stdout;
if (remoteBranch === undefined || remoteBranch.length === 0) {
Expand Down Expand Up @@ -326,6 +326,9 @@ export class GitSupportProvider implements CvsSupportProvider {
commitCommandBuilder.push(`"${this._gitPath}" -C "${this._workspaceRootPath}" commit -m "${this._checkInInfo.message}" --quiet --allow-empty-message`);
this._checkInInfo.cvsLocalResources.forEach((cvsLocalResource) => {
commitCommandBuilder.push(`"${cvsLocalResource.fileAbsPath}"`);
if (cvsLocalResource.prevFileAbsPath) {
commitCommandBuilder.push(`"${cvsLocalResource.prevFileAbsPath}"`);
}
});
return commitCommandBuilder.join(" ");
}
Expand Down
4 changes: 2 additions & 2 deletions src/dal/tfsprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export class TfsSupportProvider implements CvsSupportProvider {
const checkInCommandPrefix = `"${this._tfPath}" checkIn /comment:"${this._checkInInfo.message}" /noprompt `;
const checkInCommandSB: string[] = [];
checkInCommandSB.push(checkInCommandPrefix);
this._checkInInfo.cvsLocalResources.forEach((filePath) => {
checkInCommandSB.push(`"${filePath}" `);
this._checkInInfo.cvsLocalResources.forEach((localResource) => {
checkInCommandSB.push(`"${localResource.fileAbsPath}" `);
});
try {
await cp.exec(checkInCommandSB.join(""));
Expand Down

0 comments on commit e31bde6

Please sign in to comment.