@ -47,10 +47,11 @@ package org.eclipse.jgit.pgm;
import java.io.File ;
import java.io.File ;
import java.text.MessageFormat ;
import java.text.MessageFormat ;
import org.eclipse.jgit.errors.RepositoryNotFoundException ;
import org.eclipse.jgit.lib.RepositoryCache.FileKey ;
import org.eclipse.jgit.util.FS ;
import org.kohsuke.args4j.Argument ;
import org.kohsuke.args4j.Argument ;
import org.kohsuke.args4j.Option ;
import org.kohsuke.args4j.Option ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.Repository ;
@Command ( common = false , usage = "usage_ServerSideBackendForJgitFetch" )
@Command ( common = false , usage = "usage_ServerSideBackendForJgitFetch" )
class UploadPack extends TextBuiltin {
class UploadPack extends TextBuiltin {
@ -67,16 +68,19 @@ class UploadPack extends TextBuiltin {
@Override
@Override
protected void run ( ) throws Exception {
protected void run ( ) throws Exception {
final org . eclipse . jgit . transport . UploadPack r p;
final org . eclipse . jgit . transport . UploadPack u p;
if ( new File ( srcGitdir , Constants . DOT_GIT ) . isDirectory ( ) )
try {
srcGitdir = new File ( srcGitdir , Constants . DOT_GIT ) ;
FileKey key = FileKey . lenient ( srcGitdir , FS . DETECTED ) ;
db = new Repository ( srcGitdir ) ;
db = key . open ( true /* must exist */ ) ;
if ( ! db . getObjectsDirectory ( ) . isDirectory ( ) )
} catch ( RepositoryNotFoundException notFound ) {
throw die ( MessageFormat . format ( CLIText . get ( ) . notAGitRepository , srcGitdir . getPath ( ) ) ) ;
throw die ( MessageFormat . format ( CLIText . get ( ) . notAGitRepository ,
rp = new org . eclipse . jgit . transport . UploadPack ( db ) ;
srcGitdir . getPath ( ) ) ) ;
}
up = new org . eclipse . jgit . transport . UploadPack ( db ) ;
if ( 0 < = timeout )
if ( 0 < = timeout )
rp . setTimeout ( timeout ) ;
u p. setTimeout ( timeout ) ;
rp . upload ( System . in , System . out , System . err ) ;
u p. upload ( System . in , System . out , System . err ) ;
}
}
}
}