Skip to content

Bump libgit2 #472

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

Merged
merged 7 commits into from
Jul 2, 2015
Merged
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
2 changes: 1 addition & 1 deletion External/libgit2
Submodule libgit2 updated 86 files
+12 −2 .travis.yml
+39 −3 CHANGELOG.md
+25 −9 CMakeLists.txt
+17 −9 THREADING.md
+2 −2 examples/blame.c
+2 −0 examples/network/clone.c
+10 −16 examples/status.c
+4 −6 include/git2/blob.h
+1 −1 include/git2/describe.h
+1 −1 include/git2/diff.h
+2 −0 include/git2/errors.h
+3 −3 include/git2/remote.h
+41 −83 include/git2/submodule.h
+2 −0 include/git2/sys/stream.h
+14 −10 include/git2/types.h
+3 −3 include/git2/version.h
+4 −2 libgit2.pc.in
+0 −2 script/cibuild.sh
+0 −6 script/install-deps-linux.sh
+8 −6 src/buffer.c
+1 −1 src/buffer.h
+2 −8 src/checkout.c
+20 −0 src/config.c
+6 −0 src/config.h
+257 −0 src/curl_stream.c
+14 −0 src/curl_stream.h
+12 −7 src/diff.c
+20 −0 src/diff.h
+1 −1 src/diff_file.c
+39 −13 src/diff_patch.c
+2 −0 src/diff_patch.h
+4 −1 src/diff_print.c
+24 −57 src/diff_tform.c
+1 −1 src/fetch.c
+0 −7 src/fetch.h
+41 −2 src/index.c
+98 −0 src/iterator.c
+23 −0 src/iterator.h
+30 −86 src/merge.c
+5 −5 src/object.c
+1 −1 src/odb.c
+111 −12 src/openssl_stream.c
+2 −2 src/path.c
+3 −0 src/refspec.c
+16 −5 src/remote.c
+37 −13 src/repository.c
+0 −1 src/repository.h
+129 −3 src/stash.c
+17 −1 src/stransport_stream.c
+15 −0 src/stream.h
+412 −676 src/submodule.c
+0 −24 src/submodule.h
+22 −3 src/transports/http.c
+0 −1 src/transports/winhttp.c
+1 −0 src/unix/posix.h
+4 −1 tests/checkout/conflict.c
+15 −5 tests/checkout/crlf.c
+1 −1 tests/checkout/index.c
+1 −1 tests/clar/sandbox.h
+13 −0 tests/core/buffer.c
+41 −1 tests/diff/binary.c
+14 −14 tests/diff/blob.c
+30 −1 tests/diff/index.c
+0 −39 tests/diff/racy.c
+8 −8 tests/diff/submodules.c
+1 −1 tests/diff/tree.c
+70 −7 tests/diff/workdir.c
+47 −0 tests/fetchhead/nonetwork.c
+2 −2 tests/filter/file.c
+1 −1 tests/index/addall.c
+147 −0 tests/index/racy.c
+14 −1 tests/merge/workdir/dirty.c
+15 −0 tests/refs/revparse.c
+17 −0 tests/repo/open.c
+119 −9 tests/stash/apply.c
+11 −9 tests/stash/foreach.c
+10 −2 tests/stash/save.c
+5 −0 tests/stash/stash_helpers.c
+2 −0 tests/status/worktree.c
+3 −3 tests/submodule/init.c
+26 −0 tests/submodule/lookup.c
+77 −126 tests/submodule/modify.c
+0 −46 tests/submodule/nosubs.c
+27 −38 tests/submodule/status.c
+4 −7 tests/submodule/submodule_helpers.c
+21 −9 tests/submodule/update.c
2 changes: 1 addition & 1 deletion ObjectiveGit/GTRepository+RemoteOperations.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions

int update_fetchhead = 1;
// Ignored for push
git_remote_autotag_option_t download_tags = GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK;
git_remote_autotag_option_t download_tags = GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED;
NSString *reflog_message = [NSString stringWithFormat:@"pushing remote %@", remote.name];

gitError = git_remote_update_tips(remote.git_remote, &remote_callbacks, update_fetchhead, download_tags, reflog_message.UTF8String);
Expand Down
10 changes: 0 additions & 10 deletions ObjectiveGit/GTRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,6 @@ NS_ASSUME_NONNULL_BEGIN
/// Returns the signature.
- (GTSignature *)userSignatureForNow;

/// Reloads all cached information about the receiver's submodules.
///
/// Existing GTSubmodule objects from this repository will be mutated as part of
/// this operation.
///
/// error - If not NULL, set to any errors that occur.
///
/// Returns whether the reload succeeded.
- (BOOL)reloadSubmodules:(NSError **)error;

/// Enumerates over all the tracked submodules in the repository.
///
/// recursive - Whether to recurse into nested submodules, depth-first.
Expand Down
10 changes: 0 additions & 10 deletions ObjectiveGit/GTRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -674,16 +674,6 @@ static int submoduleEnumerationCallback(git_submodule *git_submodule, const char
return 0;
}

- (BOOL)reloadSubmodules:(NSError **)error {
int gitError = git_submodule_reload_all(self.git_repository, 0);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to reload submodules."];
return NO;
}

return YES;
}

- (void)enumerateSubmodulesRecursively:(BOOL)recursive usingBlock:(void (^)(GTSubmodule *submodule, NSError *error, BOOL *stop))block {
NSParameterAssert(block != nil);

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTSubmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
///
/// These flags are mutually exclusive.
typedef NS_ENUM(NSInteger, GTSubmoduleIgnoreRule) {
GTSubmoduleIgnoreReset = GIT_SUBMODULE_IGNORE_RESET,
GTSubmoduleIgnoreUnspecified = GIT_SUBMODULE_IGNORE_UNSPECIFIED,
GTSubmoduleIgnoreNone = GIT_SUBMODULE_IGNORE_NONE,
GTSubmoduleIgnoreUntracked = GIT_SUBMODULE_IGNORE_UNTRACKED,
GTSubmoduleIgnoreDirty = GIT_SUBMODULE_IGNORE_DIRTY,
Expand Down
8 changes: 6 additions & 2 deletions ObjectiveGit/GTSubmodule.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ - (GTSubmoduleIgnoreRule)ignoreRule {
}

- (void)setIgnoreRule:(GTSubmoduleIgnoreRule)ignoreRule {
git_submodule_set_ignore(self.git_submodule, (git_submodule_ignore_t)ignoreRule);
git_submodule_set_ignore(self.parentRepository.git_repository, git_submodule_name(self.git_submodule), (git_submodule_ignore_t)ignoreRule);

// The docs for `git_submodule_set_ignore` note "This does not affect any
// currently-loaded instances." So we need to reload.
git_submodule_reload(self.git_submodule, 0);
}

- (GTOID *)indexOID {
Expand Down Expand Up @@ -96,7 +100,7 @@ - (instancetype)initWithGitSubmodule:(git_submodule *)submodule parentRepository

- (GTSubmoduleStatus)status:(NSError **)error {
unsigned status;
int gitError = git_submodule_status(&status, self.git_submodule);
int gitError = git_submodule_status(&status, self.parentRepository.git_repository, git_submodule_name(self.git_submodule), git_submodule_ignore(self.git_submodule));
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get submodule %@ status.", self.name];
return GTSubmoduleStatusUnknown;
Expand Down
23 changes: 1 addition & 22 deletions ObjectiveGitTests/GTSubmoduleSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
expect(submodule).notTo(beNil());
expect(@(git_submodule_url(submodule.git_submodule))).notTo(equal(testURLString));

git_submodule_set_url(submodule.git_submodule, testURLString.UTF8String);
git_submodule_save(submodule.git_submodule);
git_submodule_set_url(repo.git_repository, git_submodule_name(submodule.git_submodule), testURLString.UTF8String);

__block NSError *error = nil;
expect(@([submodule writeToParentConfigurationDestructively:YES error:&error])).to(beTruthy());
Expand All @@ -79,26 +78,6 @@
expect(@(git_submodule_url(submodule.git_submodule))).to(equal(testURLString));
});

it(@"should reload all submodules", ^{
GTSubmodule *submodule = [repo submoduleWithName:@"new_submodule" error:NULL];
expect(submodule).to(beNil());

NSURL *gitmodulesURL = [repo.fileURL URLByAppendingPathComponent:@".gitmodules"];
NSMutableString *gitmodules = [NSMutableString stringWithContentsOfURL:gitmodulesURL usedEncoding:NULL error:NULL];
expect(gitmodules).notTo(beNil());

[gitmodules appendString:@"[submodule \"new_submodule\"]\n\turl = some_url\n\tpath = new_submodule_path"];
expect(@([gitmodules writeToURL:gitmodulesURL atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy());

__block NSError *error = nil;
expect(@([repo reloadSubmodules:&error])).to(beTruthy());
expect(error).to(beNil());

submodule = [repo submoduleWithName:@"new_submodule" error:NULL];
expect(submodule).notTo(beNil());
expect(submodule.path).to(equal(@"new_submodule_path"));
});

it(@"should add its HEAD to its parent's index", ^{
GTSubmodule *submodule = [repo submoduleWithName:@"Test_App" error:NULL];
expect(submodule).notTo(beNil());
Expand Down