@@ -5,7 +5,7 @@ import * as fs from 'fs'
55import { TreeDataProvider , TreeItem , TreeItemCollapsibleState ,
66 Uri , Disposable , EventEmitter , TextDocumentShowOptions ,
77 QuickPickItem , ProgressLocation , Memento , OutputChannel ,
8- workspace , commands , window , WorkspaceFoldersChangeEvent , TreeView , ThemeIcon , TreeItemCheckboxState , TreeCheckboxChangeEvent } from 'vscode'
8+ workspace , commands , window , env , WorkspaceFoldersChangeEvent , TreeView , ThemeIcon , TreeItemCheckboxState , TreeCheckboxChangeEvent } from 'vscode'
99import { NAMESPACE } from './constants'
1010import { Repository , Git } from './git/git'
1111import { Ref , RefType } from './git/api/git'
@@ -1215,6 +1215,25 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
12151215 } ) ;
12161216 }
12171217
1218+ async copyPath ( fileEntry : FileElement ) {
1219+ const diffStatus = this . getDiffStatus ( fileEntry ) ;
1220+ if ( ! diffStatus ) {
1221+ return ;
1222+ }
1223+ await env . clipboard . writeText ( diffStatus . dstAbsPath ) ;
1224+ }
1225+
1226+ async copyRelativePath ( fileEntry : FileElement ) {
1227+ const diffStatus = this . getDiffStatus ( fileEntry ) ;
1228+ if ( ! diffStatus ) {
1229+ return ;
1230+ }
1231+ // Calculate relative path from workspace folder root (not git repo root)
1232+ // Note: If the file is outside the workspace folder, the path will start with ../
1233+ const relativePath = path . relative ( this . workspaceFolder , diffStatus . dstAbsPath ) ;
1234+ await env . clipboard . writeText ( relativePath ) ;
1235+ }
1236+
12181237 dispose ( ) : void {
12191238 this . disposables . forEach ( d => d . dispose ( ) ) ;
12201239 }
0 commit comments