From 7e178bdd3e1bf6c27a55ead6ba80a52918831adc Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Wed, 25 Mar 2009 16:15:12 +0100 Subject: [PATCH 1/5] UserManual: Explain the concept of the Amend-button --- Site/UserManual/text/03 - Committing.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/Site/UserManual/text/03 - Committing.markdown b/Site/UserManual/text/03 - Committing.markdown index 4ff6fab..67534c3 100644 --- a/Site/UserManual/text/03 - Committing.markdown +++ b/Site/UserManual/text/03 - Committing.markdown @@ -30,3 +30,4 @@ If the hunk isn't specific enough, you can decrease the context size by manipula #### Committing Once you have staged all your changes, you can commit them. Enter a commit message in the center pane, but remember to use proper commit messages: your first line should be a short description of what you have changed, on which you can elaborate below that. Make sure the subject of your commit is short enough to fit in GitX's history view! Pressing the commit button will hopefully convey to you that the commit was successful, and also give you the commit hash. +The 'Amend' checkbox does what `git commit --amend` does: It enables you to amend the commit on the tip of the current branch. Checking 'Amend' will give you the commit-message of mentioned commit and also will display all of the changes the commit introduced as staged in the right-hand pane. You may then stage/unstage further changes, change the commit-message and hit 'Commit'. From 04c5c3a8cb8e2982ce16d1383327b6af406f2fda Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Thu, 26 Mar 2009 10:21:56 +0100 Subject: [PATCH 2/5] GitX: CFBuildVersion as x.x.x.xx We used the whole output of git describe before, not realizing that neither MacOS nor Sparkle are ok with alphabetic characters but instead want monotonically increasing integers. So now we just take the major version number appended with the number of commits since the last tag. Signed-off-by: Johannes Gilger --- GitX.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 9c13201..000fb40 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -757,7 +757,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`$TARGET_BUILD_DIR/gitx --git-path`\n(echo -n \"#define BUILD_NUMBER \"; git describe) > build/revision\ntouch Info.plist"; + shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`$TARGET_BUILD_DIR/gitx --git-path`\n(echo -n \"#define BUILD_NUMBER \"; git describe|sed -e \"s/\\-/\\./\" -e \"s/v//\" -e \"s/-.*//\") > build/revision\ntouch Info.plist"; }; F5792DFB0EDB570C001B0C31 /* Compile libgit2 */ = { isa = PBXShellScriptBuildPhase; From de31ea193a608867ad3bb4e6a93f2f138fe361fc Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Thu, 26 Mar 2009 12:42:56 +0100 Subject: [PATCH 3/5] HistoryView: Confirm paste to Gist if github.user is unset This patch relates to ticket #58. It adds a method which will ask for confirmation when pasting to Gist as an anonymous user. Since users which have github.user and github.token set can easily delete pasted snippets no confirmation is needed for them. Signed-off-by: Johannes Gilger --- html/views/history/history.js | 27 +++++++++++++++++++++++++++ html/views/history/index.html | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/html/views/history/history.js b/html/views/history/history.js index f8d6f64..9b1b30e 100644 --- a/html/views/history/history.js +++ b/html/views/history/history.js @@ -45,6 +45,33 @@ var Commit = function(obj) { }; + +var confirm_gist = function(confirmation_message) { + + // Check whether github user/token are set in .gitconfig + // If yes, we can paste without waiting for confirmation + token = Controller.getConfig_("github.token"); + login = Controller.getConfig_("github.user"); + if (token && login) { + gistie(); + return; + } + + // Set optional confirmation_message + confirmation_message = confirmation_message || "Yes. Paste this commit."; + // Show div#notification, since it?s set to display:none; by default + $("notification").style.display = ""; + // Reset the class (and therefore the color) + $("notification").setAttribute("class", ""); + // Hide img#spinner, since it?s visible by default + $("spinner").style.display = "none"; + // Insert the verification links into div#notification_message + $("notification_message").innerHTML = 'This will upload your commit to http://gist.github.com/' + + '
Are you sure you want to continue?

' + + 'No. Cancel. | ' + + '' + confirmation_message + ''; +} + var gistie = function() { notify("Uploading code to Gistie..", 0); diff --git a/html/views/history/index.html b/html/views/history/index.html index e5a5cf9..1fdba5d 100644 --- a/html/views/history/index.html +++ b/html/views/history/index.html @@ -14,7 +14,7 @@
From b1fccb836e14f299c60b38b1679601acc1e16503 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Thu, 26 Mar 2009 22:57:00 +0000 Subject: [PATCH 4/5] Add more defaults for handling Gists --- English.lproj/Preferences.xib | 164 ++++++++++++++++++++++++++++++++-- PBGitDefaults.h | 2 + PBGitDefaults.m | 15 ++++ 3 files changed, 174 insertions(+), 7 deletions(-) diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index db97d6f..44d184f 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -10,6 +10,7 @@ YES + @@ -405,20 +406,22 @@ YES + PBConfirmPublicGists + PBGitGist PBEnableGist - PBEnableGravatar + PBGistPublic YES - + 268 YES 268 - {{18, 38}, {111, 18}} + {{18, 80}, {111, 18}} YES @@ -459,8 +462,53 @@ 25 + + + 268 + {{38, 60}, {181, 18}} + + YES + + -2080244224 + 0 + Confirm creation of Gists + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{38, 38}, {179, 18}} + + YES + + -2080244224 + 0 + Make Gists public + + + 1211912703 + 130 + + + + + 200 + 25 + + - {400, 74} + {403, 116} + NSView @@ -718,6 +766,70 @@ 96 + + + value: values.PBConfirmPublicGists + + + + + + value: values.PBConfirmPublicGists + value + values.PBConfirmPublicGists + 2 + + + 104 + + + + enabled: values.PBEnableGist + + + + + + enabled: values.PBEnableGist + enabled + values.PBEnableGist + 2 + + + 107 + + + + enabled: values.PBEnableGist + + + + + + enabled: values.PBEnableGist + enabled + values.PBEnableGist + 2 + + + 111 + + + + value: values.PBGistPublic + + + + + + value: values.PBGistPublic + value + values.PBGistPublic + 2 + + + 113 + @@ -1000,8 +1112,10 @@ YES - + + + Integration @@ -1034,6 +1148,34 @@ + + 97 + + + YES + + + + + + 98 + + + + + 108 + + + YES + + + + + + 109 + + + @@ -1049,6 +1191,8 @@ 1.WindowOrigin 1.editorWindowContentRectSynchronizationRect 10.IBPluginDependency + 108.IBPluginDependency + 109.IBPluginDependency 11.IBPluginDependency 12.IBPluginDependency 13.IBPluginDependency @@ -1089,6 +1233,8 @@ 9.IBPluginDependency 90.IBPluginDependency 91.IBPluginDependency + 97.IBPluginDependency + 98.IBPluginDependency YES @@ -1112,6 +1258,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{514, 459}, {106, 71}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1148,7 +1296,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{474, 394}, {239, 54}} + {{474, 352}, {403, 116}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1177,7 +1327,7 @@ - 96 + 113 diff --git a/PBGitDefaults.h b/PBGitDefaults.h index 84f7a18..2e2444b 100644 --- a/PBGitDefaults.h +++ b/PBGitDefaults.h @@ -14,5 +14,7 @@ + (int) commitMessageViewVerticalLineLength; + (BOOL) isGistEnabled; + (BOOL) isGravatarEnabled; ++ (BOOL) confirmPublicGists; ++ (BOOL) isGistPublic; @end diff --git a/PBGitDefaults.m b/PBGitDefaults.m index 6b08695..676fa72 100644 --- a/PBGitDefaults.m +++ b/PBGitDefaults.m @@ -12,6 +12,8 @@ #define kCommitMessageViewVerticalLineLength @"PBCommitMessageViewVerticalLineLength" #define kEnableGist @"PBEnableGist" #define kEnableGravatar @"PBEnableGravatar" +#define kConfirmPublicGists @"PBConfirmPublicGists" +#define kPublicGist @"PBGistPublic" @implementation PBGitDefaults @@ -24,6 +26,10 @@ forKey:kEnableGist]; [defaultValues setObject:[NSNumber numberWithBool:YES] forKey:kEnableGravatar]; + [defaultValues setObject:[NSNumber numberWithBool:YES] + forKey:kConfirmPublicGists]; + [defaultValues setObject:[NSNumber numberWithBool:NO] + forKey:kPublicGist]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; } @@ -42,4 +48,13 @@ return [[NSUserDefaults standardUserDefaults] boolForKey:kEnableGravatar]; } ++ (BOOL) confirmPublicGists +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kConfirmPublicGists]; +} + ++ (BOOL) isGistPublic +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kPublicGist]; +} @end From 11c9f51302eab2b76106b117ed3080b532e54e2a Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Thu, 26 Mar 2009 22:58:32 +0000 Subject: [PATCH 5/5] Make confirmation of Gists optional This makes use of the rules that are explicit in the preferences. By default, Gists are always private and there will always be a confirmation message. Both options can be changed from the preferences menu. --- PBWebController.m | 4 ++++ html/views/history/history.js | 28 ++++++++++++---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/PBWebController.m b/PBWebController.m index b9d472d..d185593 100644 --- a/PBWebController.m +++ b/PBWebController.m @@ -127,6 +127,10 @@ return [PBGitDefaults isGravatarEnabled]; else if([feature isEqualToString:@"gist"]) return [PBGitDefaults isGistEnabled]; + else if([feature isEqualToString:@"confirmGist"]) + return [PBGitDefaults confirmPublicGists]; + else if([feature isEqualToString:@"publicGist"]) + return [PBGitDefaults isGistPublic]; else return YES; } diff --git a/html/views/history/history.js b/html/views/history/history.js index 9b1b30e..78184e8 100644 --- a/html/views/history/history.js +++ b/html/views/history/history.js @@ -47,29 +47,25 @@ var Commit = function(obj) { var confirm_gist = function(confirmation_message) { - - // Check whether github user/token are set in .gitconfig - // If yes, we can paste without waiting for confirmation - token = Controller.getConfig_("github.token"); - login = Controller.getConfig_("github.user"); - if (token && login) { + if (!Controller.isFeatureEnabled_("confirmGist")) { gistie(); return; } // Set optional confirmation_message confirmation_message = confirmation_message || "Yes. Paste this commit."; - // Show div#notification, since it?s set to display:none; by default - $("notification").style.display = ""; - // Reset the class (and therefore the color) - $("notification").setAttribute("class", ""); - // Hide img#spinner, since it?s visible by default - $("spinner").style.display = "none"; + var deleteMessage = Controller.getConfig_("github.token") ? " " : "You might not be able to delete it after posting.
"; + var publicMessage = Controller.isFeatureEnabled_("publicGist") ? "public" : "private"; // Insert the verification links into div#notification_message - $("notification_message").innerHTML = 'This will upload your commit to http://gist.github.com/' + - '
Are you sure you want to continue?

' + + var notification_text = 'This will create a ' + publicMessage + ' paste of your commit to http://gist.github.com/
' + + deleteMessage + + 'Are you sure you want to continue?

' + 'No. Cancel. | ' + '' + confirmation_message + ''; + + notify(notification_text, 0); + // Hide img#spinner, since it?s visible by default + $("spinner").style.display = "none"; } var gistie = function() { @@ -87,9 +83,9 @@ var gistie = function() { if (token && login) { parameters.login = login; parameters.token = token; - } else { - parameters.private = true; } + if (!Controller.isFeatureEnabled_("publicGist")) + parameters.private = true; var params = []; for (var name in parameters)