diff --git a/app/assets/javascripts/repository/components/fork_info.vue b/app/assets/javascripts/repository/components/fork_info.vue index 99cbe555a2dbc677da665028876b1ac75afc6eda..f3dbf98312ee8a7b8892e87df79909b733ed3ee6 100644 --- a/app/assets/javascripts/repository/components/fork_info.vue +++ b/app/assets/javascripts/repository/components/fork_info.vue @@ -332,6 +332,7 @@ export default { </div> <conflicts-modal ref="modal" + :selected-branch="selectedBranch" :source-name="sourceName" :source-path="sourcePath" :source-default-branch="sourceDefaultBranch" diff --git a/app/assets/javascripts/repository/components/fork_sync_conflicts_modal.vue b/app/assets/javascripts/repository/components/fork_sync_conflicts_modal.vue index 0bfb90bb3ecffa724f2189f2ed6d1ccc97d5d474..ffe4fd4cd3882dac5b17598e460c73a13e0260e4 100644 --- a/app/assets/javascripts/repository/components/fork_sync_conflicts_modal.vue +++ b/app/assets/javascripts/repository/components/fork_sync_conflicts_modal.vue @@ -19,10 +19,9 @@ export const i18n = { "ForksDivergence|Fetch the latest changes from the upstream repository's default branch:", ), step2Text: s__( - "ForksDivergence|Check out to a new branch, and merge the changes from the upstream project's default branch. You likely need to resolve conflicts during this step.", + "ForksDivergence|Check out to a branch, and merge the changes from the upstream project's default branch. You likely need to resolve conflicts during this step.", ), step3Text: s__('ForksDivergence|Push the updates to remote:'), - step4Text: s__("ForksDivergence|Create a merge request to your project's default branch."), copyToClipboard: __('Copy to clipboard'), close: __('Close'), }; @@ -53,12 +52,20 @@ export default { required: false, default: '', }, + selectedBranch: { + type: String, + required: true, + default: '', + }, }, computed: { instructionsStep1() { const baseUrl = getBaseURL(); return `git fetch ${baseUrl}${this.sourcePath} ${this.sourceDefaultBranch}`; }, + instructionsStep2() { + return `git checkout ${this.selectedBranch}\ngit merge FETCH_HEAD`; + }, }, methods: { show() { @@ -69,9 +76,7 @@ export default { }, }, i18n, - instructionsStep2: 'git checkout -b <new-branch-name>\ngit merge FETCH_HEAD', - instructionsStep2Clipboard: 'git checkout -b <new-branch-name>\ngit merge FETCH_HEAD', - instructionsStep3: 'git commit\ngit push', + instructionsStep3: 'git push', }; </script> <template> @@ -100,14 +105,12 @@ export default { <b> {{ $options.i18n.step2 }}</b> {{ $options.i18n.step2Text }} </p> <div class="gl-display-flex gl-mb-4"> - <pre - class="gl-w-full gl-mb-0 gl-mr-3" - data-testid="resolve-conflict-instructions" - v-html="$options.instructionsStep2 /* eslint-disable-line vue/no-v-html */" - ></pre> + <pre class="gl-w-full gl-mb-0 gl-mr-3" data-testid="resolve-conflict-instructions">{{ + instructionsStep2 + }}</pre> <modal-copy-button modal-id="fork-sync-conflicts-modal" - :text="$options.instructionsStep2Clipboard" + :text="instructionsStep2" :title="$options.i18n.copyToClipboard" class="gl-shadow-none! gl-bg-transparent! gl-flex-shrink-0" /> @@ -127,9 +130,6 @@ export default { class="gl-shadow-none! gl-bg-transparent! gl-flex-shrink-0 gl-ml-3" /> </div> - <p> - <b> {{ $options.i18n.step4 }}</b> {{ $options.i18n.step4Text }} - </p> <template #modal-footer> <gl-button @click="hide" @keydown.esc="hide">{{ $options.i18n.close }}</gl-button> </template> diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 8ef61a2aafd0a7ab0525a91192f0af5b4a3bf7d6..f09f2bc98ae6a087ad52e596424573f3d04e732b 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -18657,10 +18657,7 @@ msgstr "" msgid "ForksDivergence|%{messages} the upstream repository." msgstr "" -msgid "ForksDivergence|Check out to a new branch, and merge the changes from the upstream project's default branch. You likely need to resolve conflicts during this step." -msgstr "" - -msgid "ForksDivergence|Create a merge request to your project's default branch." +msgid "ForksDivergence|Check out to a branch, and merge the changes from the upstream project's default branch. You likely need to resolve conflicts during this step." msgstr "" msgid "ForksDivergence|Create merge request" diff --git a/spec/frontend/repository/components/fork_sync_conflicts_modal_spec.js b/spec/frontend/repository/components/fork_sync_conflicts_modal_spec.js index f97c970275bdd33f9273194304ae0b02637fb164..3fd9284e29b079f995f496ec3a924e8d7ca85838 100644 --- a/spec/frontend/repository/components/fork_sync_conflicts_modal_spec.js +++ b/spec/frontend/repository/components/fork_sync_conflicts_modal_spec.js @@ -36,7 +36,11 @@ describe('ConflictsModal', () => { expect(findInstructions().at(0).text()).toContain(propsConflictsModal.sourcePath); }); - it('renders default branch name in a first intruction', () => { + it('renders default branch name in a first step intruction', () => { expect(findInstructions().at(0).text()).toContain(propsConflictsModal.sourceDefaultBranch); }); + + it('renders selected branch name in a second step intruction', () => { + expect(findInstructions().at(1).text()).toContain(propsConflictsModal.selectedBranch); + }); }); diff --git a/spec/frontend/repository/mock_data.js b/spec/frontend/repository/mock_data.js index a6480b79d0f5dc6abb3e1c44175c1557eb410e2e..afa183c06160b44313aaa8e5fbe8cb8cce7607ee 100644 --- a/spec/frontend/repository/mock_data.js +++ b/spec/frontend/repository/mock_data.js @@ -134,4 +134,5 @@ export const propsConflictsModal = { sourceDefaultBranch: 'branch-name', sourceName: 'source-name', sourcePath: 'path/to/project', + selectedBranch: 'my-branch', };