Skip to content

Commit 93c6373

Browse files
committed
Added a version of status which accepts an ignore rule.
1 parent 9234cce commit 93c6373

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ObjectiveGit/GTSubmodule.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,17 @@ NS_ASSUME_NONNULL_BEGIN
132132
/// Returns the opened repository, or nil if an error occurs.
133133
- (nullable GTRepository *)submoduleRepository:(NSError **)error;
134134

135-
/// Determines the status for the submodule.
136-
///
137-
/// Returns the status, or `GTSubmoduleStatusUnknown` if an error occurs.
135+
/// Calls `-statusWithIgnoreRule:error:` with the submodule's ignore rule.
138136
- (GTSubmoduleStatus)status:(NSError **)error;
139137

138+
/// Determine the status for the submodule using the given ignore rule.
139+
///
140+
/// ignoreRule - The ignore rule to use in calculating status.
141+
/// error - The error if one occurred.
142+
///
143+
/// Returns the status or `GTSubmoduleStatusUnknown` if an error occurred.
144+
- (GTSubmoduleStatus)statusWithIgnoreRule:(GTSubmoduleIgnoreRule)ignoreRule error:(NSError **)error;
145+
140146
/// Initializes the submodule by copying its information into the parent
141147
/// repository's `.git/config` file. This is equivalent to `git submodule init`
142148
/// on the command line.

ObjectiveGit/GTSubmodule.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ - (instancetype)initWithGitSubmodule:(git_submodule *)submodule parentRepository
102102

103103
#pragma mark Inspection
104104

105-
- (GTSubmoduleStatus)status:(NSError **)error {
105+
- (GTSubmoduleStatus)statusWithIgnoreRule:(GTSubmoduleIgnoreRule)ignoreRule error:(NSError **)error {
106106
unsigned status;
107-
int gitError = git_submodule_status(&status, self.parentRepository.git_repository, git_submodule_name(self.git_submodule), git_submodule_ignore(self.git_submodule));
107+
int gitError = git_submodule_status(&status, self.parentRepository.git_repository, git_submodule_name(self.git_submodule), (git_submodule_ignore_t)ignoreRule);
108108
if (gitError != GIT_OK) {
109109
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get submodule %@ status.", self.name];
110110
return GTSubmoduleStatusUnknown;
@@ -113,6 +113,10 @@ - (GTSubmoduleStatus)status:(NSError **)error {
113113
return status;
114114
}
115115

116+
- (GTSubmoduleStatus)status:(NSError **)error {
117+
return [self statusWithIgnoreRule:self.ignoreRule error:error];
118+
}
119+
116120
#pragma mark Manipulation
117121

118122
- (BOOL)reload:(NSError **)error {

0 commit comments

Comments
 (0)