Skip to content

Commit

Permalink
stackEdit: improve undo tooltip for absorb
Browse files Browse the repository at this point in the history
Summary: When moving to the working copy, don't show the "Temporary commit ..." message.

Reviewed By: zzl0

Differential Revision: D67992676

fbshipit-source-id: 05d740807fc9f344a973f90858ee9f8492a9de25
  • Loading branch information
quark-zju authored and facebook-github-bot committed Jan 9, 2025
1 parent 2f24f7f commit 6c434e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addons/isl/src/stackEdit/ui/StackEditSubTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {t, T} from '../../i18n';
import {SplitCommitIcon} from '../../icons/SplitCommitIcon';
import {reorderedRevs} from '../commitStackState';
import {ReorderState} from '../reorderState';
import {bumpStackEditMetric, useStackEditState} from './stackEditState';
import {bumpStackEditMetric, useStackEditState, WDIR_NODE} from './stackEditState';
import {is} from 'immutable';
import {Button} from 'isl-components/Button';
import {Icon} from 'isl-components/Icon';
Expand Down Expand Up @@ -344,12 +344,15 @@ export function UndoDescription({op}: {op?: StackEditOpDescription}): React.Reac
return <T replace={{$file: op.path}}>editing $file via interactive split</T>;
} else if (op.name === 'absorbMove') {
const replace = {$commit: <CommitTitle commit={op.commit} />};
return <T replace={replace}>Moved a diff chunk to $commit</T>;
return <T replace={replace}>moving a diff chunk to $commit</T>;
}
return <T>unknown</T>;
}

/** Used in undo tooltip. Styled. */
function CommitTitle({commit}: {commit: CommitState}): React.ReactElement {
if (commit.originalNodes.contains(WDIR_NODE)) {
return <T>the working copy</T>;
}
return <span className="commit-title">{commit.text.split('\n', 1).at(0)}</span>;
}

0 comments on commit 6c434e0

Please sign in to comment.