File tree Expand file tree Collapse file tree 14 files changed +51
-16
lines changed Expand file tree Collapse file tree 14 files changed +51
-16
lines changed Original file line number Diff line number Diff line change
1
+ using System . IO ;
2
+
3
+ namespace SourceGit . Commands
4
+ {
5
+ public class QueryGitCommonDir : Command
6
+ {
7
+ public QueryGitCommonDir ( string workDir )
8
+ {
9
+ WorkingDirectory = workDir ;
10
+ Args = "rev-parse --git-common-dir" ;
11
+ RaiseError = false ;
12
+ }
13
+
14
+ public string Result ( )
15
+ {
16
+ var rs = ReadToEnd ( ) . StdOut ;
17
+ if ( string . IsNullOrEmpty ( rs ) )
18
+ return null ;
19
+
20
+ rs = rs . Trim ( ) ;
21
+ if ( Path . IsPathRooted ( rs ) )
22
+ return rs ;
23
+ return Path . GetFullPath ( Path . Combine ( WorkingDirectory , rs ) ) ;
24
+ }
25
+ }
26
+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ public interface IRepository
4
4
{
5
5
string FullPath { get ; set ; }
6
6
string GitDir { get ; set ; }
7
+ string GitCommonDir { get ; set ; }
7
8
8
9
void RefreshBranches ( ) ;
9
10
void RefreshWorktrees ( ) ;
Original file line number Diff line number Diff line change @@ -24,11 +24,7 @@ public Watcher(IRepository repo)
24
24
_wcWatcher . EnableRaisingEvents = true ;
25
25
26
26
// If this repository is a worktree repository, just watch the main repository's gitdir.
27
- var gitDirNormalized = _repo . GitDir . Replace ( "\\ " , "/" ) ;
28
- var worktreeIdx = gitDirNormalized . IndexOf ( ".git/worktrees/" , StringComparison . Ordinal ) ;
29
- var repoWatchDir = _repo . GitDir ;
30
- if ( worktreeIdx > 0 )
31
- repoWatchDir = _repo . GitDir . Substring ( 0 , worktreeIdx + 4 ) ;
27
+ var repoWatchDir = _repo . GitCommonDir . Replace ( "\\ " , "/" ) ;
32
28
33
29
_repoWatcher = new FileSystemWatcher ( ) ;
34
30
_repoWatcher . Path = repoWatchDir ;
Original file line number Diff line number Diff line change 501
501
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Remote löschen</x : String >
502
502
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Ziel:</x : String >
503
503
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Worktrees löschen</x : String >
504
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Worktree Informationen in `$GIT_DIR /worktrees` löschen</x : String >
504
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Worktree Informationen in `$GIT_COMMON_DIR /worktrees` löschen</x : String >
505
505
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
506
506
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Remote-Branch:</x : String >
507
507
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Alle Branches fetchen</x : String >
Original file line number Diff line number Diff line change 504
504
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Prune Remote</x : String >
505
505
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Target:</x : String >
506
506
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Prune Worktrees</x : String >
507
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Prune worktree information in `$GIT_DIR /worktrees`</x : String >
507
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Prune worktree information in `$GIT_COMMON_DIR /worktrees`</x : String >
508
508
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
509
509
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Remote Branch:</x : String >
510
510
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Fetch all branches</x : String >
Original file line number Diff line number Diff line change 508
508
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Podar Remoto</x : String >
509
509
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Destino:</x : String >
510
510
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Podar Worktrees</x : String >
511
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Podar información de worktree en `$GIT_DIR /worktrees`</x : String >
511
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Podar información de worktree en `$GIT_COMMON_DIR /worktrees`</x : String >
512
512
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
513
513
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Rama Remota:</x : String >
514
514
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Fetch todas las ramas</x : String >
Original file line number Diff line number Diff line change 476
476
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Élaguer une branche distant</x : String > <!-- If it is indeed about a branch -->
477
477
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Cible :</x : String >
478
478
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Élaguer les Worktrees</x : String >
479
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" > Élaguer les information de worktree dans `$GIT_DIR /worktrees`</x : String >
479
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" > Élaguer les information de worktree dans `$GIT_COMMON_DIR /worktrees`</x : String >
480
480
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
481
481
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Branche distante :</x : String >
482
482
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Fetch toutes les branches</x : String >
Original file line number Diff line number Diff line change 507
507
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Potatura Remota</x : String >
508
508
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Destinazione:</x : String >
509
509
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Potatura Worktrees</x : String >
510
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Potatura delle informazioni di worktree in `$GIT_DIR /worktrees`</x : String >
510
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Potatura delle informazioni di worktree in `$GIT_COMMON_DIR /worktrees`</x : String >
511
511
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Scarica</x : String >
512
512
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Branch Remoto:</x : String >
513
513
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Recupera tutti i branch</x : String >
Original file line number Diff line number Diff line change 490
490
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Prunar Remoto</x : String >
491
491
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Alvo:</x : String >
492
492
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Podar Worktrees</x : String >
493
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Podar informações de worktree em `$GIT_DIR /worktrees`</x : String >
493
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Podar informações de worktree em `$GIT_COMMON_DIR /worktrees`</x : String >
494
494
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Puxar</x : String >
495
495
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Branch Remoto:</x : String >
496
496
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Buscar todos os branches</x : String >
Original file line number Diff line number Diff line change 508
508
<x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Удалить внешний репозиторий</x : String >
509
509
<x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Цель:</x : String >
510
510
<x : String x : Key =" Text.PruneWorktrees" xml : space =" preserve" >Удалить рабочий каталог</x : String >
511
- <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Информация об обрезке рабочего каталога в «$GIT_DIR /worktrees»</x : String >
511
+ <x : String x : Key =" Text.PruneWorktrees.Tip" xml : space =" preserve" >Информация об обрезке рабочего каталога в «$GIT_COMMON_DIR /worktrees»</x : String >
512
512
<x : String x : Key =" Text.Pull" xml : space =" preserve" >Забрать</x : String >
513
513
<x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Ветка внешнего репозитория:</x : String >
514
514
<x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Извлечь все ветки</x : String >
You can’t perform that action at this time.
0 commit comments