{"thread":{"id":"39598","subject":"[PATCH] Fix power checking on OS X","startedAt":"2015-06-11T14:37:25Z","lastAt":"2015-06-12T15:58:44Z","messageCount":5,"participants":["Panagiotis Astithas","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"263586","messageId":"1434033445-35903-1-git-send-email-pastith@gmail.com","threadId":"39598","inReplyTo":null,"subject":"[PATCH] Fix power checking on OS X","fromName":"Panagiotis Astithas","fromEmail":"pastith@gmail.com","sentAt":"2015-06-11T14:37:25Z","receivedAt":"2015-06-11T14:37:25Z","isPatch":true,"sender":{"key":"pastith@gmail.com","avatar":"https://avatars.githubusercontent.com/u/49118?v=4"},"body":"The output of \"pmset -g batt\" changed at some point from\n\"Currently drawing from 'AC Power'\" to the slightly different\n\"Now drawing from 'AC Power'\". Starting the match from \"drawing\"\nmakes the check work in both old and new versions of OS X.\n\nSigned-off-by: Panagiotis Astithas <pastith@gmail.com>\n---\n contrib/hooks/pre-auto-gc-battery | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery\nindex 9d0c2d1..6a2cdeb 100755\n--- a/contrib/hooks/pre-auto-gc-battery\n+++ b/contrib/hooks/pre-auto-gc-battery\n@@ -33,7 +33,7 @@ elif grep -q \"AC Power \\+: 1\" /proc/pmu/info 2>/dev/null\n then\n \texit 0\n elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt |\n-\tgrep -q \"Currently drawing from 'AC Power'\"\n+\tgrep -q \"drawing from 'AC Power'\"\n then\n \texit 0\n fi\n-- \n2.4.1\n"},{"id":"263645","messageId":"CAPig+cRzKpCePO0gXy7Rok4X7=r6tas28tv48g92YzP9tVP2AA@mail.gmail.com","threadId":"39598","inReplyTo":"1434033445-35903-1-git-send-email-pastith@gmail.com","subject":"Re: [PATCH] Fix power checking on OS X","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-12T03:46:42Z","receivedAt":"2015-06-12T03:46:42Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Jun 11, 2015 at 10:37 AM, Panagiotis Astithas <pastith@gmail.com> wrote:\n> The output of \"pmset -g batt\" changed at some point from\n> \"Currently drawing from 'AC Power'\" to the slightly different\n> \"Now drawing from 'AC Power'\". Starting the match from \"drawing\"\n> makes the check work in both old and new versions of OS X.\n\nWould it make sense to try to future-proof this further by searching\nonly for \"'AC\" (including the leading single-quote) or just \"AC\"\n(without the leading quote)?\n\n(Genuine question. I don't have a strong feeling about it.)\n\n> Signed-off-by: Panagiotis Astithas <pastith@gmail.com>\n> ---\n> diff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery\n> index 9d0c2d1..6a2cdeb 100755\n> --- a/contrib/hooks/pre-auto-gc-battery\n> +++ b/contrib/hooks/pre-auto-gc-battery\n> @@ -33,7 +33,7 @@ elif grep -q \"AC Power \\+: 1\" /proc/pmu/info 2>/dev/null\n>  then\n>         exit 0\n>  elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt |\n> -       grep -q \"Currently drawing from 'AC Power'\"\n> +       grep -q \"drawing from 'AC Power'\"\n>  then\n>         exit 0\n>  fi\n> --\n> 2.4.1\n"},{"id":"263652","messageId":"CACvVhd7sKiz+gTDY_RVjFf1i3Rt2pYWVsgjewyPHL1ajS5LTcQ@mail.gmail.com","threadId":"39598","inReplyTo":"CAPig+cRzKpCePO0gXy7Rok4X7=r6tas28tv48g92YzP9tVP2AA@mail.gmail.com","subject":"Re: [PATCH] Fix power checking on OS X","fromName":"Panagiotis Astithas","fromEmail":"pastith@gmail.com","sentAt":"2015-06-12T08:53:32Z","receivedAt":"2015-06-12T08:53:32Z","isPatch":true,"sender":{"key":"pastith@gmail.com","avatar":"https://avatars.githubusercontent.com/u/49118?v=4"},"body":"On Fri, Jun 12, 2015 at 6:46 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Thu, Jun 11, 2015 at 10:37 AM, Panagiotis Astithas <pastith@gmail.com> wrote:\n>> The output of \"pmset -g batt\" changed at some point from\n>> \"Currently drawing from 'AC Power'\" to the slightly different\n>> \"Now drawing from 'AC Power'\". Starting the match from \"drawing\"\n>> makes the check work in both old and new versions of OS X.\n>\n> Would it make sense to try to future-proof this further by searching\n> only for \"'AC\" (including the leading single-quote) or just \"AC\"\n> (without the leading quote)?\n>\n> (Genuine question. I don't have a strong feeling about it.)\n\nIt's a reasonable idea, although I'm wondering what are the odds of\npmset changing to output a string when running on battery in the\nfuture, containing something like \"no longer on 'AC Power'\". That's\nprobably too far out though.\n"},{"id":"263666","messageId":"xmqqr3phdlj3.fsf@gitster.dls.corp.google.com","threadId":"39598","inReplyTo":"CACvVhd7sKiz+gTDY_RVjFf1i3Rt2pYWVsgjewyPHL1ajS5LTcQ@mail.gmail.com","subject":"Re: [PATCH] Fix power checking on OS X","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-12T14:54:56Z","receivedAt":"2015-06-12T14:54:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Panagiotis Astithas <pastith@gmail.com> writes:\n\n> On Fri, Jun 12, 2015 at 6:46 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>> On Thu, Jun 11, 2015 at 10:37 AM, Panagiotis Astithas <pastith@gmail.com> wrote:\n>>> The output of \"pmset -g batt\" changed at some point from\n>>> \"Currently drawing from 'AC Power'\" to the slightly different\n>>> \"Now drawing from 'AC Power'\". Starting the match from \"drawing\"\n>>> makes the check work in both old and new versions of OS X.\n>>\n>> Would it make sense to try to future-proof this further by searching\n>> only for \"'AC\" (including the leading single-quote) or just \"AC\"\n>> (without the leading quote)?\n>>\n>> (Genuine question. I don't have a strong feeling about it.)\n>\n> It's a reasonable idea, although I'm wondering what are the odds of\n> pmset changing to output a string when running on battery in the\n> future, containing something like \"no longer on 'AC Power'\". That's\n> probably too far out though.\n\nOnce they start drawing from USB-C, they may stop referring to AC\naltogether; unless you have a crystal ball, it is futile to spend\ntoo many brain cycles to try futureproofing.\n\nPrediction is very difficult, especially if it's about the future.\n"},{"id":"263669","messageId":"CAPig+cQrVoYdLrcmdw698LX=bgXkBZvyD35+K6yLLP4H-W-N=w@mail.gmail.com","threadId":"39598","inReplyTo":"CACvVhd7sKiz+gTDY_RVjFf1i3Rt2pYWVsgjewyPHL1ajS5LTcQ@mail.gmail.com","subject":"Re: [PATCH] Fix power checking on OS X","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-12T15:58:44Z","receivedAt":"2015-06-12T15:58:44Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 12, 2015 at 4:53 AM, Panagiotis Astithas <pastith@gmail.com> wrote:\n> On Fri, Jun 12, 2015 at 6:46 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>> On Thu, Jun 11, 2015 at 10:37 AM, Panagiotis Astithas <pastith@gmail.com> wrote:\n>>> The output of \"pmset -g batt\" changed at some point from\n>>> \"Currently drawing from 'AC Power'\" to the slightly different\n>>> \"Now drawing from 'AC Power'\". Starting the match from \"drawing\"\n>>> makes the check work in both old and new versions of OS X.\n>>\n>> Would it make sense to try to future-proof this further by searching\n>> only for \"'AC\" (including the leading single-quote) or just \"AC\"\n>> (without the leading quote)?\n>>\n>> (Genuine question. I don't have a strong feeling about it.)\n>\n> It's a reasonable idea, although I'm wondering what are the odds of\n> pmset changing to output a string when running on battery in the\n> future, containing something like \"no longer on 'AC Power'\". That's\n> probably too far out though.\n\nThat was my concern, as well, hence not feeling strongly about it.\n"}]}