Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "git-graph-2",
"displayName": "Git Graph 2",
"version": "1.31.6",
"version": "1.31.6-alpha-1",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can upgrade the version if you want.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for an extra version

"publisher": "hansu",
"author": {
"name": "Michael Hutchison",
Expand Down
6 changes: 3 additions & 3 deletions src/baseGitGraphView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export abstract class BaseGitGraphView extends Disposable {
});
break;
case 'createPullRequest':
errorInfos = [msg.push ? await this.dataSource.pushBranch(msg.repo, msg.sourceBranch, msg.sourceRemote, true, GitPushBranchMode.Normal) : null];
errorInfos = [msg.push ? await this.dataSource.pushBranch(msg.repo, msg.sourceBranch, msg.sourceRemote, true, GitPushBranchMode.Normal, false) : null];
if (errorInfos[0] === null) {
errorInfos.push(await createPullRequest(msg.config, msg.sourceOwner, msg.sourceRepo, msg.sourceBranch));
}
Expand Down Expand Up @@ -493,7 +493,7 @@ export abstract class BaseGitGraphView extends Disposable {
this.sendMessage({
command: 'pushBranch',
willUpdateBranchConfig: msg.willUpdateBranchConfig,
errors: await this.dataSource.pushBranchToMultipleRemotes(msg.repo, msg.branchName, msg.remotes, msg.setUpstream, msg.mode)
errors: await this.dataSource.pushBranchToMultipleRemotes(msg.repo, msg.branchName, msg.remotes, msg.setUpstream, msg.mode, msg.noVerify)
});
break;
case 'pushStash':
Expand Down Expand Up @@ -558,7 +558,7 @@ export abstract class BaseGitGraphView extends Disposable {
case 'editCommitMessage':
this.sendMessage({
command: 'editCommitMessage',
error: await this.dataSource.editCommitMessage(msg.repo, msg.commitHash, msg.message)
error: await this.dataSource.editCommitMessage(msg.repo, msg.commitHash, msg.message, msg.noVerify)
});
break;
case 'setGlobalViewState':
Expand Down
12 changes: 8 additions & 4 deletions src/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,11 +817,12 @@ export class DataSource extends Disposable {
* @param mode The mode of the push.
* @returns The ErrorInfo from the executed command.
*/
public pushBranch(repo: string, branchName: string, remote: string, setUpstream: boolean, mode: GitPushBranchMode) {
public pushBranch(repo: string, branchName: string, remote: string, setUpstream: boolean, mode: GitPushBranchMode, noVerify: boolean) {
let args = ['push'];
args.push(remote, branchName);
if (setUpstream) args.push('--set-upstream');
if (mode !== GitPushBranchMode.Normal) args.push('--' + mode);
if (noVerify) args.push('--no-verify');

return this.runGitCommand(args, repo);
}
Expand All @@ -835,14 +836,14 @@ export class DataSource extends Disposable {
* @param mode The mode of the push.
* @returns The ErrorInfo's from the executed commands.
*/
public async pushBranchToMultipleRemotes(repo: string, branchName: string, remotes: string[], setUpstream: boolean, mode: GitPushBranchMode): Promise<ErrorInfo[]> {
public async pushBranchToMultipleRemotes(repo: string, branchName: string, remotes: string[], setUpstream: boolean, mode: GitPushBranchMode, noVerify: boolean): Promise<ErrorInfo[]> {
if (remotes.length === 0) {
return ['No remote(s) were specified to push the branch ' + branchName + ' to.'];
}

const results: ErrorInfo[] = [];
for (let i = 0; i < remotes.length; i++) {
const result = await this.pushBranch(repo, branchName, remotes[i], setUpstream, mode);
const result = await this.pushBranch(repo, branchName, remotes[i], setUpstream, mode, noVerify);
results.push(result);
if (result !== null) break;
}
Expand Down Expand Up @@ -1194,6 +1195,7 @@ export class DataSource extends Disposable {
* @returns The ErrorInfo from the executed command.
*/
public async squashCommits(repo: string, commits: ReadonlyArray<string>, commitMessage: string): Promise<ErrorInfo> {

if (commits.length < 2) {
return 'At least 2 commits are required for squashing.';
}
Expand Down Expand Up @@ -1261,7 +1263,7 @@ export class DataSource extends Disposable {
* @param message The new commit message.
* @returns The ErrorInfo from the executed command.
*/
public async editCommitMessage(repo: string, commitHash: string, message: string): Promise<ErrorInfo> {
public async editCommitMessage(repo: string, commitHash: string, message: string, noVerify: boolean): Promise<ErrorInfo> {
try {
const headCommit = await this.spawnGit(['rev-parse', 'HEAD'], repo, (stdout) => stdout.trim());

Expand All @@ -1270,6 +1272,8 @@ export class DataSource extends Disposable {
if (getConfig().signCommits) {
args.push('-S');
}
if (noVerify) args.push('--no-verify');

return this.runGitCommand(args, repo);
} else {
return this.rebaseEditCommitMessage(repo, commitHash, message);
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ export interface RequestPushBranch extends RepoRequest {
readonly branchName: string;
readonly remotes: string[];
readonly setUpstream: boolean;
readonly noVerify: boolean;
readonly mode: GitPushBranchMode;
readonly willUpdateBranchConfig: boolean;
}
Expand Down Expand Up @@ -1200,6 +1201,7 @@ export interface RequestEditCommitMessage extends RepoRequest {
readonly command: 'editCommitMessage';
readonly commitHash: string;
readonly message: string;
readonly noVerify: boolean;
}
export interface ResponseEditCommitMessage extends ResponseWithErrorInfo {
readonly command: 'editCommitMessage';
Expand Down
11 changes: 8 additions & 3 deletions web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,8 @@ class GitGraphView {
name: 'Commit Message',
default: commit.message,
placeholder: 'Enter the new commit message'
}],
},
{ type: DialogInputType.Checkbox, name: 'No Verify', value: false }],
'Update Message',
(values) => {
const newMessage = <string>values[0];
Expand All @@ -1048,7 +1049,8 @@ class GitGraphView {
command: 'editCommitMessage',
repo: this.currentRepo,
commitHash: hash,
message: newMessage
message: newMessage,
noVerify: <boolean>values[1]
}, 'Editing Commit Message');
},
target
Expand Down Expand Up @@ -1322,7 +1324,8 @@ class GitGraphView {
{ name: 'Force', value: GG.GitPushBranchMode.Force }
],
default: GG.GitPushBranchMode.Normal
}
},
{ type: DialogInputType.Checkbox, name: 'No Verify', value: false }
];

if (multipleRemotes) {
Expand All @@ -1338,13 +1341,15 @@ class GitGraphView {
dialog.showForm('Are you sure you want to push the branch <b><i>' + escapeHtml(refName) + '</i></b>' + (multipleRemotes ? '' : ' to the remote <b><i>' + escapeHtml(this.gitRemotes[0]) + '</i></b>') + '?', inputs, 'Yes, push', (values) => {
const remotes = multipleRemotes ? <string[]>values.shift() : [this.gitRemotes[0]];
const setUpstream = <boolean>values[0];
const noVerify = <boolean>values[2];
runAction({
command: 'pushBranch',
repo: this.currentRepo,
branchName: refName,
remotes: remotes,
setUpstream: setUpstream,
mode: <GG.GitPushBranchMode>values[1],
noVerify: noVerify,
willUpdateBranchConfig: setUpstream && remotes.length > 0 && (this.gitConfig === null || typeof this.gitConfig.branches[refName] === 'undefined' || this.gitConfig.branches[refName].remote !== remotes[remotes.length - 1])
}, 'Pushing Branch');
}, target);
Expand Down