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
44 {
55 string FullPath { get ; set ; }
66 string GitDir { get ; set ; }
7+ string GitCommonDir { get ; set ; }
78
89 void RefreshBranches ( ) ;
910 void RefreshWorktrees ( ) ;
Original file line number Diff line number Diff line change @@ -24,11 +24,7 @@ public Watcher(IRepository repo)
2424 _wcWatcher . EnableRaisingEvents = true ;
2525
2626 // 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 ( "\\ " , "/" ) ;
3228
3329 _repoWatcher = new FileSystemWatcher ( ) ;
3430 _repoWatcher . Path = repoWatchDir ;
Original file line number Diff line number Diff line change 501501 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Remote löschen</x : String >
502502 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Ziel:</x : String >
503503 <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 >
505505 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
506506 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Remote-Branch:</x : String >
507507 <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 504504 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Prune Remote</x : String >
505505 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Target:</x : String >
506506 <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 >
508508 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
509509 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Remote Branch:</x : String >
510510 <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 508508 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Podar Remoto</x : String >
509509 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Destino:</x : String >
510510 <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 >
512512 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
513513 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Rama Remota:</x : String >
514514 <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 476476 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Élaguer une branche distant</x : String > <!-- If it is indeed about a branch -->
477477 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Cible :</x : String >
478478 <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 >
480480 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Pull</x : String >
481481 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Branche distante :</x : String >
482482 <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 507507 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Potatura Remota</x : String >
508508 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Destinazione:</x : String >
509509 <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 >
511511 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Scarica</x : String >
512512 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Branch Remoto:</x : String >
513513 <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 490490 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Prunar Remoto</x : String >
491491 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Alvo:</x : String >
492492 <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 >
494494 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Puxar</x : String >
495495 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Branch Remoto:</x : String >
496496 <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 508508 <x : String x : Key =" Text.PruneRemote" xml : space =" preserve" >Удалить внешний репозиторий</x : String >
509509 <x : String x : Key =" Text.PruneRemote.Target" xml : space =" preserve" >Цель:</x : String >
510510 <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 >
512512 <x : String x : Key =" Text.Pull" xml : space =" preserve" >Забрать</x : String >
513513 <x : String x : Key =" Text.Pull.Branch" xml : space =" preserve" >Ветка внешнего репозитория:</x : String >
514514 <x : String x : Key =" Text.Pull.FetchAllBranches" xml : space =" preserve" >Извлечь все ветки</x : String >
You can’t perform that action at this time.
0 commit comments