<commit_before>import * as React from 'react'

import { FileStatus } from '../../models/status'
import { Octicon, OcticonSymbol } from '../octicons'
import { PathText } from './path-text'

interface IPathLabelProps {
  /** the current path of the file */
  readonly path: string,
  /** the previous path of the file, if applicable */
  readonly oldPath?: string,
  /** the type of change applied to the file */
  readonly status: FileStatus

  readonly availableWidth: number
}

/**
 * Render the path details for a given file.
 *
 * For renames, this will render the old path as well as the current path.
 * For other scenarios, only the current path is rendered.
 *
 */
export class PathLabel extends React.Component<IPathLabelProps, void> {
  public render() {

    const props: React.HTMLProps<HTMLLabelElement> = {
      className: 'path',
    }

    if (this.props.status === FileStatus.Renamed && this.props.oldPath) {
      return (
        <label {...props}>
          {this.props.oldPath} <Octicon symbol={OcticonSymbol.arrowRight} /> {this.props.path}
        </label>
      )
    } else {
      return <label {...props}><PathText path={this.props.path} availableWidth={this.props.availableWidth} /></label>
    }
  }
}<commit_msg>copied file should also show both paths<commit_after>import * as React from 'react'

import { FileStatus } from '../../models/status'
import { Octicon, OcticonSymbol } from '../octicons'
import { PathText } from './path-text'

interface IPathLabelProps {
  /** the current path of the file */
  readonly path: string,
  /** the previous path of the file, if applicable */
  readonly oldPath?: string,
  /** the type of change applied to the file */
  readonly status: FileStatus

  readonly availableWidth: number
}

/**
 * Render the path details for a given file.
 *
 * For renames, this will render the old path as well as the current path.
 * For other scenarios, only the current path is rendered.
 *
 */
export class PathLabel extends React.Component<IPathLabelProps, void> {
  public render() {

    const props: React.HTMLProps<HTMLLabelElement> = {
      className: 'path',
    }

    const status = this.props.status
    const renderBothPaths = status === FileStatus.Renamed || status === FileStatus.Copied

    if (renderBothPaths && this.props.oldPath) {
      return (
        <label {...props}>
          {this.props.oldPath} <Octicon symbol={OcticonSymbol.arrowRight} /> {this.props.path}
        </label>
      )
    } else {
      return <label {...props}><PathText path={this.props.path} availableWidth={this.props.availableWidth} /></label>
    }
  }
}
{'fraction_non_alphanumeric': 0.12476081132797551, 'fraction_numerical': 0.0, 'mean_word_length': 3.1036106750392465, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4599368', 'n_tokens_mistral': 751, 'n_tokens_neox': 744, 'n_words': 248}