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

Tweaks #587

Merged
merged 15 commits into from
Nov 26, 2017
Merged

Tweaks #587

merged 15 commits into from
Nov 26, 2017

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Aug 15, 2016

This is a collection of "old" tweaks I have lying around (extracted from #297 actually).

Most of them should be independent, but there are some "breaking" API changes in c31df0c & 80dac00 which change what's returned as a name — e.g. old refs/heads/master/refs/heads/origin/master (the underlying reference name) vs new master/origin/master).

@@ -62,15 +64,15 @@ NS_ASSUME_NONNULL_BEGIN
/// repo - The repository containing the branch. Must not be nil.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation should be updated after the repo arg is no longer present

@tiennou
Copy link
Contributor Author

tiennou commented Mar 2, 2017

@pietbrauer Just noticed I opened this some time ago now. Can it be merged ?

Well, going through the changes, I feel that some more tests would be nice...

@pietbrauer
Copy link
Member

@tiennou if you feel you need to add tests I am all for it. Will have a look once they are in

@tiennou
Copy link
Contributor Author

tiennou commented Mar 3, 2017

I'll try to then. I may also have some more minor tweaks I found recently : we needed a -[GTCommit parentOIDs] call, which libgit2 has but we don't wrap directly, and -[GTOID hash] allocates an NSData just for hashing purposes (which showed up in profiles when graphing with GitX).

@tiennou tiennou force-pushed the tweaks branch 2 times, most recently from 8c09e8b to d1d34a1 Compare June 19, 2017 20:57
@tiennou
Copy link
Contributor Author

tiennou commented Jun 19, 2017

(Re-)rebased against master.

I wrote tests for the major parts, as I don't think it's worthwhile to test things like accessors. Unless you want me too 😉. I also added a few things from GitX, and I'll make another PR with the proposed hashing changes.

@pietbrauer
Copy link
Member

Looks good to me but could you fix the indentation in GTRepository.m?

From 36be9eef09a7d659061d07134472ad965c5d273e Mon Sep 17 00:00:00 2001
From: Piet Brauer <piet@nerdishbynature.com>
Date: Wed, 28 Jun 2017 22:11:50 +0200
Subject: [PATCH] Fix indentation

---
 ObjectiveGit/GTRepository.m | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m
index cf181a0..e455da7 100644
--- a/ObjectiveGit/GTRepository.m
+++ b/ObjectiveGit/GTRepository.m
@@ -325,7 +325,7 @@ struct GTRemoteCreatePayload {
 		return nil;
 	}
 
-    return [GTObject objectWithObj:obj inRepository:self];
+	return [GTObject objectWithObj:obj inRepository:self];
 }
 
 - (id)lookUpObjectByGitOid:(const git_oid *)oid error:(NSError **)error {
@@ -402,8 +402,8 @@ typedef void (^GTRepositoryBranchEnumerationBlock)(GTBranch *branch, BOOL *stop)
 	git_reference *gitRef = NULL;
 	int gitError = git_branch_iterator_new(&iter, self.git_repository, (git_branch_t)type);
 	if (gitError != GIT_OK) {
-        if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
-        return NO;
+		if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
+		return NO;
 	}
 
 	git_branch_t branchType;
@@ -416,11 +416,11 @@ typedef void (^GTRepositoryBranchEnumerationBlock)(GTBranch *branch, BOOL *stop)
 	}
 
 	if (gitError != GIT_OK && gitError != GIT_ITEROVER) {
-        if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
-        return NO;
+		if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
+		return NO;
 	}
 
-    return YES;
+	return YES;
 }
 
 - (NSArray *)localBranchesWithError:(NSError **)error {
-- 
2.12.2

Copy link
Member

@pietbrauer pietbrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated above:

From 36be9eef09a7d659061d07134472ad965c5d273e Mon Sep 17 00:00:00 2001
From: Piet Brauer <piet@nerdishbynature.com>
Date: Wed, 28 Jun 2017 22:11:50 +0200
Subject: [PATCH] Fix indentation

---
 ObjectiveGit/GTRepository.m | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m
index cf181a0..e455da7 100644
--- a/ObjectiveGit/GTRepository.m
+++ b/ObjectiveGit/GTRepository.m
@@ -325,7 +325,7 @@ struct GTRemoteCreatePayload {
 		return nil;
 	}
 
-    return [GTObject objectWithObj:obj inRepository:self];
+	return [GTObject objectWithObj:obj inRepository:self];
 }
 
 - (id)lookUpObjectByGitOid:(const git_oid *)oid error:(NSError **)error {
@@ -402,8 +402,8 @@ typedef void (^GTRepositoryBranchEnumerationBlock)(GTBranch *branch, BOOL *stop)
 	git_reference *gitRef = NULL;
 	int gitError = git_branch_iterator_new(&iter, self.git_repository, (git_branch_t)type);
 	if (gitError != GIT_OK) {
-        if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
-        return NO;
+		if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
+		return NO;
 	}
 
 	git_branch_t branchType;
@@ -416,11 +416,11 @@ typedef void (^GTRepositoryBranchEnumerationBlock)(GTBranch *branch, BOOL *stop)
 	}
 
 	if (gitError != GIT_OK && gitError != GIT_ITEROVER) {
-        if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
-        return NO;
+		if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
+		return NO;
 	}
 
-    return YES;
+	return YES;
 }
 
 - (NSArray *)localBranchesWithError:(NSError **)error {
-- 
2.12.2

@tiennou
Copy link
Contributor Author

tiennou commented Nov 26, 2017

Made the requested indentation fixups, and rebased !

@pietbrauer pietbrauer merged commit 13fd094 into libgit2:master Nov 26, 2017
@tiennou tiennou deleted the tweaks branch November 26, 2017 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants