Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show branch name near commit message box #74495

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion extensions/git/src/repository.ts
Expand Up @@ -679,7 +679,7 @@ export class Repository implements Disposable {

const root = Uri.file(repository.root);
this._sourceControl = scm.createSourceControl('git', 'Git', root);
this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message (press {0} to commit)");
this.updateInputBox();
this._sourceControl.acceptInputCommand = { command: 'git.commit', title: localize('commit', "Commit"), arguments: [this._sourceControl] };
this._sourceControl.quickDiffProvider = this;
this._sourceControl.inputBox.validateInput = this.validateInput.bind(this);
Expand Down Expand Up @@ -727,6 +727,12 @@ export class Repository implements Disposable {
this.updateCommitTemplate();
}

updateInputBox() {
const headless: Boolean = this.headLabel === '';
// '{0}' will be replaced by the corresponding key-command later in the process, which is why it needs to stay.
this._sourceControl.inputBox.placeholder = localize(headless ? 'commitMessage' : 'commitMessageWithHeadLabel', "Message ({0} to commit{1})", "{0}", headless ? 'this.headLabel' : ' to ' + this.headLabel);
Copy link
Member

@joaomoreno joaomoreno Aug 8, 2019

Choose a reason for hiding this comment

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

This still breaks localization.

}

validateInput(text: string, position: number): SourceControlInputBoxValidation | undefined {
if (this.rebaseCommit) {
if (this.rebaseCommit.message !== text) {
Expand Down
1 change: 1 addition & 0 deletions extensions/git/src/statusbar.ts
Expand Up @@ -24,6 +24,7 @@ class CheckoutStatusBar {
get command(): Command | undefined {
const rebasing = !!this.repository.rebaseCommit;
const title = `$(git-branch) ${this.repository.headLabel}${rebasing ? ` (${localize('rebasing', 'Rebasing')})` : ''}`;
this.repository.updateInputBox();

return {
command: 'git.checkout',
Expand Down