@@ -19,7 +19,7 @@ import {
19
19
import { App } from '../shared/appBase' ;
20
20
import { DOM } from '../shared/dom' ;
21
21
22
- const rebaseActions = [ 'pick' , 'reword' , 'edit' , 'squash' , 'fixup' , 'drop' ] ;
22
+ const rebaseActions = [ 'pick' , 'reword' , 'edit' , 'squash' , 'fixup' , 'drop' , 'update-ref' ] ;
23
23
const rebaseActionsMap = new Map < string , RebaseEntryAction > ( [
24
24
[ 'p' , 'pick' ] ,
25
25
[ 'P' , 'pick' ] ,
@@ -33,6 +33,8 @@ const rebaseActionsMap = new Map<string, RebaseEntryAction>([
33
33
[ 'F' , 'fixup' ] ,
34
34
[ 'd' , 'drop' ] ,
35
35
[ 'D' , 'drop' ] ,
36
+ [ 'u' , 'update-ref' ] ,
37
+ [ 'U' , 'update-ref' ] ,
36
38
] ) ;
37
39
38
40
class RebaseEditor extends App < State > {
@@ -414,6 +416,7 @@ class RebaseEditor extends App<State> {
414
416
index : 0 ,
415
417
message : commit . message ,
416
418
sha : state . onto . sha ,
419
+ branch : undefined ! ,
417
420
} ,
418
421
state ,
419
422
++ tabIndex ,
@@ -448,6 +451,7 @@ class RebaseEditor extends App<State> {
448
451
$entry . classList . add ( 'entry' , `entry--${ action } ` ) ;
449
452
$entry . classList . toggle ( 'entry--squash-to' , squashToHere ) ;
450
453
$entry . dataset . sha = entry . sha ;
454
+ $entry . dataset . branch = entry . branch ;
451
455
452
456
let $content : HTMLElement = $entry ;
453
457
if ( action === 'base' ) {
@@ -467,24 +471,30 @@ class RebaseEditor extends App<State> {
467
471
$selectContainer . classList . add ( 'entry-action' , 'select-container' ) ;
468
472
$entry . appendChild ( $selectContainer ) ;
469
473
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
+ }
479
492
480
- if ( entry . action === action ) {
481
- $option . selected = true ;
493
+ $options . appendChild ( $option ) ;
482
494
}
483
-
484
- $options . appendChild ( $option ) ;
495
+ $select . appendChild ( $options ) ;
496
+ $selectContainer . appendChild ( $select ) ;
485
497
}
486
- $select . appendChild ( $options ) ;
487
- $selectContainer . appendChild ( $select ) ;
488
498
}
489
499
490
500
const commit = entry . commit ;
@@ -537,11 +547,18 @@ class RebaseEditor extends App<State> {
537
547
}
538
548
}
539
549
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
+ }
545
562
546
563
return [ $entry , tabIndex ] ;
547
564
}
0 commit comments