Skip to content

Commit

Permalink
Delete Tag on Remotes too
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Kyriakis committed Dec 31, 2011
1 parent 031defd commit 7d5cc36
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions PBGitRepository.m
Expand Up @@ -1241,6 +1241,32 @@ - (BOOL) deleteRemoteBranch:(PBGitRef *)ref
return retVal;
}

- (BOOL) deleteRemoteTag:(PBGitRef *)ref
{
BOOL retVal = YES;

if (ref && ([ref refishType] == kGitXTagType) && [self hasRemotes])
{
int gitRetValue = 1;

NSArray *remotes = [self remotes];
NSArray *arguments;

for (int i=0; i<[remotes count]; i++)
{
arguments = [NSArray arrayWithObjects:@"push", [remotes objectAtIndex:i], [NSString stringWithFormat:@":%@",[ref shortName]], nil];
NSString * output = [self outputForArguments:arguments retValue:&gitRetValue];
if (gitRetValue > 1) {
NSString *message = [NSString stringWithFormat:@"There was an error deleting the remotetag: %@/%@\n\n", [remotes objectAtIndex:i],[ref shortName]];
[self.windowController showErrorSheetTitle:@"Delete tag on remote failed!" message:message arguments:arguments output:output];
retVal = NO;
}
}
}

[self reloadRefs];
return retVal;
}

- (BOOL) deleteRef:(PBGitRef *)ref
{
Expand All @@ -1255,6 +1281,10 @@ - (BOOL) deleteRef:(PBGitRef *)ref
{
[self deleteRemoteBranch:ref];
}
else if ([ref refishType] == kGitXTagType)
{
[self deleteRemoteTag:ref];
}

int retValue = 1;
NSArray *arguments = [NSArray arrayWithObjects:@"update-ref", @"-d", [ref ref], nil];
Expand Down

0 comments on commit 7d5cc36

Please sign in to comment.