From b4bcc58b3e48020cb428849f8ce1cd88bcc8251d Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 14 Oct 2008 01:00:42 +0200 Subject: [PATCH] CommitView/Gistie: Use github.user and github.login This changes the Gistie paste code to use the github.user and github.login git config variables for a token and login name. --- PBWebHistoryController.m | 5 +++++ html/commit.js | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m index 3cb52e6..14bdf82 100644 --- a/PBWebHistoryController.m +++ b/PBWebHistoryController.m @@ -123,4 +123,9 @@ contextMenuItemsForElement:(NSDictionary *)element [[NSWorkspace sharedWorkspace] openURL:[request URL]]; } +- getConfig:(NSString *)config +{ + return [historyController valueForKeyPath:[@"repository.config." stringByAppendingString:config]]; +} + @end diff --git a/html/commit.js b/html/commit.js index 5d1f757..7ac89c0 100644 --- a/html/commit.js +++ b/html/commit.js @@ -58,8 +58,15 @@ var gistie = function() { }; // TODO: Replace true with private preference - if (true) + token = Controller.getConfig_("github.token"); + login = Controller.getConfig_("github.user"); + if (token && login) + { + parameters.login = login; + parameters.token = token; + } else { parameters.private = true; + } new Ajax.Request("http://gist.github.com/gists", { method: 'post',