@@ -19,7 +19,7 @@ import {
1919import { App } from '../shared/appBase' ;
2020import { DOM } from '../shared/dom' ;
2121
22- const rebaseActions = [ 'pick' , 'reword' , 'edit' , 'squash' , 'fixup' , 'drop' ] ;
22+ const rebaseActions = [ 'pick' , 'reword' , 'edit' , 'squash' , 'fixup' , 'drop' , 'update-ref' ] ;
2323const rebaseActionsMap = new Map < string , RebaseEntryAction > ( [
2424 [ 'p' , 'pick' ] ,
2525 [ 'P' , 'pick' ] ,
@@ -33,6 +33,8 @@ const rebaseActionsMap = new Map<string, RebaseEntryAction>([
3333 [ 'F' , 'fixup' ] ,
3434 [ 'd' , 'drop' ] ,
3535 [ 'D' , 'drop' ] ,
36+ [ 'u' , 'update-ref' ] ,
37+ [ 'U' , 'update-ref' ] ,
3638] ) ;
3739
3840class RebaseEditor extends App < State > {
@@ -414,6 +416,7 @@ class RebaseEditor extends App<State> {
414416 index : 0 ,
415417 message : commit . message ,
416418 sha : state . onto . sha ,
419+ branch : undefined ! ,
417420 } ,
418421 state ,
419422 ++ tabIndex ,
@@ -448,6 +451,7 @@ class RebaseEditor extends App<State> {
448451 $entry . classList . add ( 'entry' , `entry--${ action } ` ) ;
449452 $entry . classList . toggle ( 'entry--squash-to' , squashToHere ) ;
450453 $entry . dataset . sha = entry . sha ;
454+ $entry . dataset . branch = entry . branch ;
451455
452456 let $content : HTMLElement = $entry ;
453457 if ( action === 'base' ) {
@@ -467,24 +471,30 @@ class RebaseEditor extends App<State> {
467471 $selectContainer . classList . add ( 'entry-action' , 'select-container' ) ;
468472 $entry . appendChild ( $selectContainer ) ;
469473
470- const $select = document . createElement ( 'select' ) ;
471- $select . dataset . sha = entry . sha ;
472- $select . name = 'action' ;
473-
474- const $options = document . createDocumentFragment ( ) ;
475- for ( const action of rebaseActions ) {
476- const $option = document . createElement ( 'option' ) ;
477- $option . value = action ;
478- $option . text = action ;
474+ if ( action === 'update-ref' ) {
475+ const $updateRefAction = document . createElement ( 'span' ) ;
476+ $updateRefAction . textContent = 'Update Ref' ;
477+ $selectContainer . appendChild ( $updateRefAction ) ;
478+ } else {
479+ const $select = document . createElement ( 'select' ) ;
480+ $select . dataset . sha = entry . sha ;
481+ $select . name = 'action' ;
482+
483+ const $options = document . createDocumentFragment ( ) ;
484+ for ( const action of rebaseActions ) {
485+ const $option = document . createElement ( 'option' ) ;
486+ $option . value = action ;
487+ $option . text = action ;
488+
489+ if ( entry . action === action ) {
490+ $option . selected = true ;
491+ }
479492
480- if ( entry . action === action ) {
481- $option . selected = true ;
493+ $options . appendChild ( $option ) ;
482494 }
483-
484- $options . appendChild ( $option ) ;
495+ $select . appendChild ( $options ) ;
496+ $selectContainer . appendChild ( $select ) ;
485497 }
486- $select . appendChild ( $options ) ;
487- $selectContainer . appendChild ( $select ) ;
488498 }
489499
490500 const commit = entry . commit ;
@@ -537,11 +547,18 @@ class RebaseEditor extends App<State> {
537547 }
538548 }
539549
540- const $sha = document . createElement ( 'a' ) ;
541- $sha . classList . add ( 'entry-sha' , 'icon--commit' ) ;
542- $sha . href = state . commands . commit . replace ( this . commitTokenRegex , commit ?. sha ?? entry . sha ) ;
543- $sha . textContent = entry . sha . substr ( 0 , 7 ) ;
544- $content . appendChild ( $sha ) ;
550+ if ( entry . action != 'update-ref' ) {
551+ const $sha = document . createElement ( 'a' ) ;
552+ $sha . classList . add ( 'entry-sha' , 'icon--commit' ) ;
553+ $sha . href = state . commands . commit . replace ( this . commitTokenRegex , commit ?. sha ?? entry . sha ) ;
554+ $sha . textContent = entry . sha . substr ( 0 , 7 ) ;
555+ $content . appendChild ( $sha ) ;
556+ } else {
557+ const $branch = document . createElement ( 'span' ) ;
558+ $branch . classList . add ( 'entry-sha' , 'icon--branch' ) ;
559+ $branch . textContent = entry . branch ;
560+ $content . appendChild ( $branch ) ;
561+ }
545562
546563 return [ $entry , tabIndex ] ;
547564 }
0 commit comments