Skip to content

Commit

Permalink
fix merging a remote branch
Browse files Browse the repository at this point in the history
falsely tried to merge the local counterpart instead
  • Loading branch information
phil294 committed May 14, 2023
1 parent 09211a0 commit 0ab1161
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The only required parameters per action are `title` and `args`.
"title": "Switch", // Whatever you want to appear on the button itself. Title is also used as a cache key (see `Save` above).
"icon": "arrow-swap", // An icon to display next to the title. Choose one from https://microsoft.github.io/vscode-codicons/dist/codicon.html
"args": "switch '$1'", // The actual command, appended to `git `. This will be executed WITHOUT VALIDATION SO BE CAREFUL. $1, $2 and so on are placeholders for the respective `params`.
"params": [ "{BRANCH_NAME}" ], // Default values for the `args` placeholders. You can write anything here, including special keywords that include: {BRANCH_NAME}, {COMMIT_HASH}, {COMMIT_HASHES}, {STASH_NAME}, {TAG_NAME}, {SOURCE_BRANCH_NAME} and {TARGET_BRANCH_NAME} (where it makes sense).
"params": [ "{LOCAL_BRANCH_NAME}" ], // Default values for the `args` placeholders. You can write anything here, including special keywords that include: {BRANCH_NAME}, {LOCAL_BRANCH_NAME}, {COMMIT_HASH}, {COMMIT_HASHES}, {STASH_NAME}, {TAG_NAME}, {SOURCE_BRANCH_NAME} and {TARGET_BRANCH_NAME} (where it makes sense).
// `options` are just an easy and quick way to toggle common trailing options. You can also specify them manually in `args` of course, given that `args` is also editable yet again at runtime.
"options": [
{ "value": "--detach", "default_active": false },
Expand Down
5 changes: 3 additions & 2 deletions web/src/views/CommitDetails.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import GitActionButton from './GitActionButton.vue'
import RefTip from './RefTip.vue'
``###*
# @typedef {import('./types').Commit} Commit
# @typedef {import('./types').Branch} Branch
###
###* @template T @typedef {import('vue').Ref<T>} Ref ###
###* @template T @typedef {import('vue').ComputedRef<T>} ComputedRef ###
Expand Down Expand Up @@ -65,8 +66,8 @@ export default defineComponent
commit_actions(props.commit.hash).value
_stash_actions = computed =>
stash_actions(stash.value?.name or '').value
_branch_actions = computed => (###* @type string ### branch_name) =>
branch_actions(branch_name).value
_branch_actions = computed => (###* @type Branch ### branch) =>
branch_actions(branch).value
_tag_actions = computed => (###* @type string ### tag_name) =>
tag_actions(tag_name).value

Expand Down
2 changes: 1 addition & 1 deletion web/src/views/CommitDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ div
li
ref-tip :git_ref="branch_tip" :commit="commit"
.row.gap-5.wrap
git-action-button v-for="action of branch_actions(branch_tip.name)" :git_action="action"
git-action-button v-for="action of branch_actions(branch_tip)" :git_action="action"

div v-if="tags.length"
ul.tags v-for="tag, tag_i of tags"
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/RefTip.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default defineComponent
combine_branches(source_branch_name, props.git_ref.id)
context_menu_provider: computed => =>
if is_branch.value
to_context_menu_entries(branch_actions(props.git_ref.name).value)
to_context_menu_entries(branch_actions(props.git_ref).value)
else if props.git_ref.type == 'stash' and props.commit
to_context_menu_entries(stash_actions(props.git_ref.name).value)
else if props.git_ref.type == 'tag'
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/default-git-actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
"immediate": true,
"args": "checkout '$1'",
"params": [
"{BRANCH_NAME}"
"{LOCAL_BRANCH_NAME}"
]
},
{
Expand Down
8 changes: 5 additions & 3 deletions web/src/views/store.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ export commit_actions = (###* @type string ### hash) => computed =>
parse_config_actions(config_commit_actions.value, [['{COMMIT_HASH}', hash]])
export commits_actions = (###* @type string[] ### hashes) => computed =>
parse_config_actions(config_commits_actions.value, [['{COMMIT_HASHES}', hashes.join(' ')]])
export branch_actions = (###* @type string ### branch_name) => computed =>
parse_config_actions(config_branch_actions.value, [['{BRANCH_NAME}', branch_name]])
export branch_actions = (###* @type Branch ### branch) => computed =>
parse_config_actions(config_branch_actions.value, [
['{BRANCH_NAME}', branch.id]
['{LOCAL_BRANCH_NAME}', branch.name]])
export tag_actions = (###* @type string ### tag_name) => computed =>
parse_config_actions(config_tag_actions.value, [['{TAG_NAME}', tag_name]])
``###* @type {Ref<ConfigGitAction[]>} ###
Expand All @@ -103,7 +105,7 @@ export stash_actions = (###* @type string ### stash_name) => computed =>
_unparsed_combine_branches_actions = ref []
export combine_branches_actions = computed =>
parse_config_actions(_unparsed_combine_branches_actions.value, [
['{SOURCE_BRANCH_NAME}', combine_branches_from_branch_name.value],
['{SOURCE_BRANCH_NAME}', combine_branches_from_branch_name.value]
['{TARGET_BRANCH_NAME}', combine_branches_to_branch_name.value]])

export combine_branches_to_branch_name = ref ''
Expand Down

0 comments on commit 0ab1161

Please sign in to comment.