Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for SSH clone #478

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ObjectiveGitTests/GTRepositorySpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@
workdirURL = [self.tempDirectoryFileURL URLByAppendingPathComponent:@"temp-repo"];
});

describe(@"with remote ssh repositories", ^{
beforeEach(^{
originURL = [NSURL URLWithString:@"ssh://github.com/libgit2/rugged.git"];
workdirURL = [self.tempDirectoryFileURL URLByAppendingPathComponent:@"rugged"];
});

it(@"should accept ssh urls", ^{
NSError *error = nil;
__block BOOL credentialProviderCalled = NO;
GTCredentialProvider *provider = [GTCredentialProvider providerWithBlock:^GTCredential * __nonnull(GTCredentialType type, NSString *URL, NSString *username) {
credentialProviderCalled = YES;
return nil;
}];

repository = [GTRepository cloneFromURL:originURL toWorkingDirectory:workdirURL options:@{ GTRepositoryCloneOptionsCredentialProvider: provider } error:&error transferProgressBlock:transferProgressBlock checkoutProgressBlock:checkoutProgressBlock];
NSError *underlyingError = error.userInfo[NSUnderlyingErrorKey];
expect(underlyingError.localizedDescription).notTo(equal(@"Unsupported URL protocol"));
expect(error).notTo(beNil());
expect(@(credentialProviderCalled)).to(beTruthy());
});
});

describe(@"with local repositories", ^{
beforeEach(^{
originURL = self.bareFixtureRepository.gitDirectoryURL;
Expand Down
12 changes: 7 additions & 5 deletions script/update_libgit2
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,32 @@ PATH="/usr/local/bin:$PATH"

if [ "External/libgit2.a" -nt "External/libgit2" ]
then
echo "No update needed."
exit 0
echo "No update needed."
exit 0
fi

cd "External/libgit2"

if [ -d "build" ]; then
rm -rf "build"
rm -rf "build"
fi

mkdir build
cd build

export CMAKE_PREFIX_PATH="/usr/local/include/"

cmake -DBUILD_SHARED_LIBS:BOOL=OFF \
-DLIBSSH2_INCLUDE_DIR:PATH=/usr/local/include/ \
-DBUILD_CLAR:BOOL=OFF \
-DTHREADSAFE:BOOL=ON \
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -D GIT_SSH" \
..
cmake --build .

product="libgit2.a"
install_path="../../${product}"
if [ "${product}" -nt "${install_path}" ]; then
cp -v "${product}" "${install_path}"
cp -v "${product}" "${install_path}"
fi

echo "libgit2 has been updated."
1 change: 1 addition & 0 deletions script/update_libgit2_ios
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function build_libgit2 ()
-DTHREADSAFE:BOOL=ON \
"${SYS_ROOT}" \
-DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -D GIT_SSH" \
.. >> "${LOG}" 2>&1
cmake --build . --target install >> "${LOG}" 2>&1

Expand Down