Skip to content

Commit 9312438

Browse files
heipeiPieter de Bie
authored andcommitted
PBGitCommit: Add "Sign-Off" button/method
This adds a small method signOff which simply appends a SOB-line to the current commit-message, using user.name and user.email. Signed-off-by: Johannes Gilger <[email protected]> Signed-off-by: Pieter de Bie <[email protected]>
1 parent 963969a commit 9312438

File tree

3 files changed

+74
-20
lines changed

3 files changed

+74
-20
lines changed

PBGitCommitController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@
4949

5050
- (IBAction) refresh:(id) sender;
5151
- (IBAction) commit:(id) sender;
52+
- (IBAction)signOff:(id)sender;
5253
@end

PBGitCommitController.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ - (void) removeView
4848
[super finalize];
4949
}
5050

51+
- (IBAction)signOff:(id)sender
52+
{
53+
if (![repository.config valueForKeyPath:@"user.name"] || ![repository.config valueForKeyPath:@"user.email"])
54+
return [[repository windowController] showMessageSheet:@"User's name not set" infoText:@"Signing off a commit requires setting user.name and user.email in your git config"];
55+
56+
commitMessageView.string = [NSString stringWithFormat:@"%@\n\nSigned-off-by: %@ <%@>",
57+
commitMessageView.string,
58+
[repository.config valueForKeyPath:@"user.name"],
59+
[repository.config valueForKeyPath:@"user.email"]];
60+
}
61+
5162
- (void) setAmend:(BOOL)newAmend
5263
{
5364
if (newAmend == amend)

PBGitCommitView.xib

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
2+
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
33
<data>
44
<int key="IBDocument.SystemTarget">1050</int>
5-
<string key="IBDocument.SystemVersion">9G55</string>
6-
<string key="IBDocument.InterfaceBuilderVersion">677</string>
7-
<string key="IBDocument.AppKitVersion">949.43</string>
5+
<string key="IBDocument.SystemVersion">9J61</string>
6+
<string key="IBDocument.InterfaceBuilderVersion">672</string>
7+
<string key="IBDocument.AppKitVersion">949.46</string>
88
<string key="IBDocument.HIToolboxVersion">353.00</string>
99
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
1010
<bool key="EncodedWithXMLCoder">YES</bool>
11+
<integer value="207"/>
1112
<integer value="226"/>
12-
<integer value="1" id="9"/>
1313
</object>
1414
<object class="NSArray" key="IBDocument.PluginDependencies">
1515
<bool key="EncodedWithXMLCoder">YES</bool>
1616
<string>com.apple.WebKitIBPlugin</string>
1717
<string>com.apple.InterfaceBuilderKit</string>
1818
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1919
</object>
20-
<object class="NSMutableDictionary" key="IBDocument.Metadata">
21-
<bool key="EncodedWithXMLCoder">YES</bool>
22-
<object class="NSArray" key="dict.sortedKeys">
23-
<bool key="EncodedWithXMLCoder">YES</bool>
24-
</object>
25-
<object class="NSMutableArray" key="dict.values">
26-
<bool key="EncodedWithXMLCoder">YES</bool>
27-
</object>
28-
</object>
2920
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
3021
<bool key="EncodedWithXMLCoder">YES</bool>
3122
<object class="NSCustomObject" id="1001">
@@ -91,6 +82,7 @@
9182
<object class="NSMutableArray" key="set.sortedObjects">
9283
<bool key="EncodedWithXMLCoder">YES</bool>
9384
<string>Apple HTML pasteboard type</string>
85+
<string>Apple PDF pasteboard type</string>
9486
<string>Apple PICT pasteboard type</string>
9587
<string>Apple URL pasteboard type</string>
9688
<string>Apple Web Archive pasteboard type</string>
@@ -101,6 +93,7 @@
10193
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
10294
<string>NeXT TIFF v4.0 pasteboard type</string>
10395
<string>WebURLsWithTitlesPboardType</string>
96+
<string>public.png</string>
10497
<string>public.url</string>
10598
<string>public.url-name</string>
10699
</object>
@@ -124,7 +117,7 @@
124117
<bool key="EncodedWithXMLCoder">YES</bool>
125118
<integer value="12" id="777559147"/>
126119
<reference ref="777559147"/>
127-
<reference ref="9"/>
120+
<integer value="1" id="9"/>
128121
</object>
129122
</object>
130123
</object>
@@ -509,6 +502,26 @@
509502
<int key="NSPeriodicInterval">25</int>
510503
</object>
511504
</object>
505+
<object class="NSButton" id="1042222292">
506+
<reference key="NSNextResponder" ref="154221104"/>
507+
<int key="NSvFlags">289</int>
508+
<string key="NSFrame">{{243, 0}, {96, 32}}</string>
509+
<reference key="NSSuperview" ref="154221104"/>
510+
<bool key="NSEnabled">YES</bool>
511+
<object class="NSButtonCell" key="NSCell" id="964972443">
512+
<int key="NSCellFlags">67239424</int>
513+
<int key="NSCellFlags2">134217728</int>
514+
<string key="NSContents">Sign-Off</string>
515+
<reference key="NSSupport" ref="554612341"/>
516+
<reference key="NSControlView" ref="1042222292"/>
517+
<int key="NSButtonFlags">-2038284033</int>
518+
<int key="NSButtonFlags2">129</int>
519+
<string key="NSAlternateContents"/>
520+
<string key="NSKeyEquivalent"/>
521+
<int key="NSPeriodicDelay">200</int>
522+
<int key="NSPeriodicInterval">25</int>
523+
</object>
524+
</object>
512525
</object>
513526
<string key="NSFrameSize">{429, 200}</string>
514527
<reference key="NSSuperview" ref="635871052"/>
@@ -1188,6 +1201,14 @@
11881201
</object>
11891202
<int key="connectionID">277</int>
11901203
</object>
1204+
<object class="IBConnectionRecord">
1205+
<object class="IBActionConnection" key="connection">
1206+
<string key="label">signOff:</string>
1207+
<reference key="source" ref="1001"/>
1208+
<reference key="destination" ref="1042222292"/>
1209+
</object>
1210+
<int key="connectionID">280</int>
1211+
</object>
11911212
</object>
11921213
<object class="IBMutableOrderedSet" key="objectRecords">
11931214
<object class="NSArray" key="orderedObjects">
@@ -1310,6 +1331,7 @@
13101331
<reference ref="227052526"/>
13111332
<reference ref="792511503"/>
13121333
<reference ref="18874447"/>
1334+
<reference ref="1042222292"/>
13131335
</object>
13141336
<reference key="parent" ref="217294340"/>
13151337
</object>
@@ -1513,6 +1535,20 @@
15131535
<reference key="object" ref="446885874"/>
15141536
<reference key="parent" ref="1002"/>
15151537
</object>
1538+
<object class="IBObjectRecord">
1539+
<int key="objectID">278</int>
1540+
<reference key="object" ref="1042222292"/>
1541+
<object class="NSMutableArray" key="children">
1542+
<bool key="EncodedWithXMLCoder">YES</bool>
1543+
<reference ref="964972443"/>
1544+
</object>
1545+
<reference key="parent" ref="635871052"/>
1546+
</object>
1547+
<object class="IBObjectRecord">
1548+
<int key="objectID">279</int>
1549+
<reference key="object" ref="964972443"/>
1550+
<reference key="parent" ref="1042222292"/>
1551+
</object>
15161552
</object>
15171553
</object>
15181554
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -1548,6 +1584,8 @@
15481584
<string>247.IBPluginDependency</string>
15491585
<string>248.IBPluginDependency</string>
15501586
<string>254.IBPluginDependency</string>
1587+
<string>278.IBPluginDependency</string>
1588+
<string>279.IBPluginDependency</string>
15511589
<string>42.IBPluginDependency</string>
15521590
<string>45.IBPluginDependency</string>
15531591
<string>46.IBPluginDependency</string>
@@ -1568,7 +1606,7 @@
15681606
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
15691607
<string>com.apple.InterfaceBuilderKit</string>
15701608
<string>com.apple.InterfaceBuilderKit</string>
1571-
<string>{{312, 206}, {852, 432}}</string>
1609+
<string>{{59, 63}, {852, 432}}</string>
15721610
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
15731611
<integer value="0" id="8"/>
15741612
<reference ref="8"/>
@@ -1585,7 +1623,7 @@
15851623
<string>PBNiceSplitView</string>
15861624
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
15871625
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1588-
<string>{{341, 587}, {616, 169}}</string>
1626+
<string>{{295, 587}, {616, 169}}</string>
15891627
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
15901628
<string>{{132, 614}, {616, 0}}</string>
15911629
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1598,6 +1636,8 @@
15981636
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
15991637
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
16001638
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1639+
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1640+
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
16011641
<string>PBFileChangesTableView</string>
16021642
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
16031643
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1630,7 +1670,7 @@
16301670
</object>
16311671
</object>
16321672
<nil key="sourceID"/>
1633-
<int key="maxID">277</int>
1673+
<int key="maxID">280</int>
16341674
</object>
16351675
<object class="IBClassDescriber" key="IBDocument.Classes">
16361676
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1660,11 +1700,13 @@
16601700
<bool key="EncodedWithXMLCoder">YES</bool>
16611701
<string>commit:</string>
16621702
<string>refresh:</string>
1703+
<string>signOff:</string>
16631704
</object>
16641705
<object class="NSMutableArray" key="dict.values">
16651706
<bool key="EncodedWithXMLCoder">YES</bool>
16661707
<string>id</string>
16671708
<string>id</string>
1709+
<string>id</string>
16681710
</object>
16691711
</object>
16701712
<object class="NSMutableDictionary" key="outlets">
@@ -1681,9 +1723,9 @@
16811723
<bool key="EncodedWithXMLCoder">YES</bool>
16821724
<string>NSArrayController</string>
16831725
<string>NSTextView</string>
1684-
<string>id</string>
1726+
<string>PBGitIndexController</string>
16851727
<string>NSArrayController</string>
1686-
<string>id</string>
1728+
<string>PBWebChangesController</string>
16871729
</object>
16881730
</object>
16891731
<object class="IBClassDescriptionSource" key="sourceIdentifier">

0 commit comments

Comments
 (0)