Changeset 10470
- Timestamp:
- 01/03/11 03:54:12 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/RepositoryPlugin/lib/Foswiki/Plugins/RepositoryPlugin.pm
r10469 r10470 160 160 my $texit; 161 161 162 my $repoRoot = _findRepoRoot ( $absfile ); 163 return "*Unable to find git root:* =$absfile= " unless ($repoRoot); 164 165 my $repoLoc = "--git-dir=$repoRoot/.git --work-tree=$repoRoot"; 166 162 167 (my $topicStatus, $texit) = 163 Foswiki::Sandbox->sysCommand( "$gitbin status --porcelain $absfile ",168 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc status --porcelain $absfile ", 164 169 ); 165 170 … … 178 183 179 184 (my $topicinfo, $texit) = 180 Foswiki::Sandbox->sysCommand( "$gitbin log -1 $absfile ",185 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc log -1 $absfile ", 181 186 ); 182 187 183 188 my $report = 184 "*Repo file:* =$absfile= \n\n ";189 "*Repo file:* =$absfile= \n\n*Repo root:* $repoRoot\n\n"; 185 190 186 191 $report .= "*File Status:* ($topicStatus) - $status\n\n"; … … 195 200 196 201 my ( $gitinfo, $gexit ) = 197 Foswiki::Sandbox->sysCommand( "$gitbin svn info ",202 Foswiki::Sandbox->sysCommand( "$gitbin $repoLoc svn info ", 198 203 ); 199 204 … … 201 206 202 207 my ( $svninfo, $sexit ) = 203 Foswiki::Sandbox->sysCommand( "$svnbin info ",208 Foswiki::Sandbox->sysCommand( "$svnbin $repoLoc info ", 204 209 ); 205 210 $repoInfo{type} = 'svn' unless ($sexit || $svninfo =~ m/not a working copy/); … … 272 277 } 273 278 279 sub _findRepoRoot { 280 281 my $repoFile = shift; # full path of a file in repo 282 283 my ($vol, $dir, $file) = File::Spec->splitpath( $repoFile ); 284 my @dirs = File::Spec->splitdir( $dir ); 285 my $repoRoot; 286 287 while ( scalar @dirs > 1 ) { 288 $repoRoot = File::Spec->catdir( @dirs ); 289 #print STDERR "Trying $repoRoot \n"; 290 last if (-d "$repoRoot/.git"); 291 pop(@dirs); 292 } 293 294 return $repoRoot if (-d "$repoRoot/.git"); 295 296 return 0; 297 } 298 274 299 1; 275 300 __END__
Note: See TracChangeset
for help on using the changeset viewer.
