{"thread":{"id":"35249","subject":"Help creating git alias","startedAt":"2013-10-30T19:34:13Z","lastAt":"2013-10-31T20:06:43Z","messageCount":15,"participants":["Eugene Sajine","Andrew Ardill","Ralf Thielow","Junio C Hamano","David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"229855","messageId":"CAPZPVFbiSx8n0W1kcczCdC6ioVuWpwuUQ_pc9T=7i4X_FuZNhg@mail.gmail.com","threadId":"35249","inReplyTo":null,"subject":"Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-30T19:34:13Z","receivedAt":"2013-10-30T19:34:13Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"Hi,\n\nI need some advice about creating the git command alias:\n\nI have this as the command:\n\ngit log --pretty=format:\"%h %ad %ae %s\" --date=short | sed 's/@\\S*//g'\n\n\nThe purpose is to cut off the email domain and keep only username.\n\nI'm trying to create this as the alias:\n\n\nlg = !sh -c 'git log --pretty=format:\"%h %ad %ae %s\" --date=short |\nsed 's/@\\S*//g'' -\n\nbut it complains about the \\S and i'm failing to come up with the\nescape sequence to make it work right.\n\nI know i can work around that by creating shell alias, but it is not\nwhat i would like to have.\n\nAny ideas?\n\nThanks!\n"},{"id":"229857","messageId":"CAH5451kcTCYaXK4tqsCkHFNLxE0z8tv=n6h6QS_VkMpnWAsdGA@mail.gmail.com","threadId":"35249","inReplyTo":"CAPZPVFbiSx8n0W1kcczCdC6ioVuWpwuUQ_pc9T=7i4X_FuZNhg@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2013-10-30T19:47:00Z","receivedAt":"2013-10-30T19:47:00Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"Have you tried backslash escaping the backslash? double escaping?\n\nI don't know how many are required, but I would try first \\S, then\n\\\\S, then \\\\\\\\S, etc\nRegards,\n\nAndrew Ardill\n\n\nOn 30 October 2013 12:34, Eugene Sajine <euguess@gmail.com> wrote:\n> Hi,\n>\n> I need some advice about creating the git command alias:\n>\n> I have this as the command:\n>\n> git log --pretty=format:\"%h %ad %ae %s\" --date=short | sed 's/@\\S*//g'\n>\n>\n> The purpose is to cut off the email domain and keep only username.\n>\n> I'm trying to create this as the alias:\n>\n>\n> lg = !sh -c 'git log --pretty=format:\"%h %ad %ae %s\" --date=short |\n> sed 's/@\\S*//g'' -\n>\n> but it complains about the \\S and i'm failing to come up with the\n> escape sequence to make it work right.\n>\n> I know i can work around that by creating shell alias, but it is not\n> what i would like to have.\n>\n> Any ideas?\n>\n> Thanks!\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"229858","messageId":"CAPZPVFaDyjxw_vQG_4wo0opw5KEX9sKMJnVNXGUJnCQGnBrB2g@mail.gmail.com","threadId":"35249","inReplyTo":"CAH5451kcTCYaXK4tqsCkHFNLxE0z8tv=n6h6QS_VkMpnWAsdGA@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-30T19:53:05Z","receivedAt":"2013-10-30T19:53:05Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Wed, Oct 30, 2013 at 3:47 PM, Andrew Ardill <andrew.ardill@gmail.com> wrote:\n> Have you tried backslash escaping the backslash? double escaping?\n>\n> I don't know how many are required, but I would try first \\S, then\n> \\\\S, then \\\\\\\\S, etc\n> Regards,\n>\n> Andrew Ardill\n\nWhen i do that it stops understanding \\S* as regexp so it removes only\n\"@\", while i need to remove from @ to the next whitespace\n\nThanks,\nEugene\n\n\n\n>\n> On 30 October 2013 12:34, Eugene Sajine <euguess@gmail.com> wrote:\n>> Hi,\n>>\n>> I need some advice about creating the git command alias:\n>>\n>> I have this as the command:\n>>\n>> git log --pretty=format:\"%h %ad %ae %s\" --date=short | sed 's/@\\S*//g'\n>>\n>>\n>> The purpose is to cut off the email domain and keep only username.\n>>\n>> I'm trying to create this as the alias:\n>>\n>>\n>> lg = !sh -c 'git log --pretty=format:\"%h %ad %ae %s\" --date=short |\n>> sed 's/@\\S*//g'' -\n>>\n>> but it complains about the \\S and i'm failing to come up with the\n>> escape sequence to make it work right.\n>>\n>> I know i can work around that by creating shell alias, but it is not\n>> what i would like to have.\n>>\n>> Any ideas?\n>>\n>> Thanks!\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"229859","messageId":"CAN0XMOKMF235S-23QcMj5cBup+Lh4vQs7QcOqXQ-MgafsAMKNg@mail.gmail.com","threadId":"35249","inReplyTo":"CAPZPVFbiSx8n0W1kcczCdC6ioVuWpwuUQ_pc9T=7i4X_FuZNhg@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2013-10-30T19:57:47Z","receivedAt":"2013-10-30T19:57:47Z","isPatch":false,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"lg=!git log --pretty=format:'%h %ad %ae %s' --date=short | sed 's/@\\\\S*//g'\n\nshould work.\n\nOn Wed, Oct 30, 2013 at 8:34 PM, Eugene Sajine <euguess@gmail.com> wrote:\n> Hi,\n>\n> I need some advice about creating the git command alias:\n>\n> I have this as the command:\n>\n> git log --pretty=format:\"%h %ad %ae %s\" --date=short | sed 's/@\\S*//g'\n>\n>\n> The purpose is to cut off the email domain and keep only username.\n>\n> I'm trying to create this as the alias:\n>\n>\n> lg = !sh -c 'git log --pretty=format:\"%h %ad %ae %s\" --date=short |\n> sed 's/@\\S*//g'' -\n>\n> but it complains about the \\S and i'm failing to come up with the\n> escape sequence to make it work right.\n>\n> I know i can work around that by creating shell alias, but it is not\n> what i would like to have.\n>\n> Any ideas?\n>\n> Thanks!\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"229861","messageId":"CAPZPVFZ9WujUCQ1O9VfV83XUu_6g7Vp_MmYRCCO+GptOoSyvcg@mail.gmail.com","threadId":"35249","inReplyTo":"CAN0XMOKMF235S-23QcMj5cBup+Lh4vQs7QcOqXQ-MgafsAMKNg@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-30T20:10:44Z","receivedAt":"2013-10-30T20:10:44Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Wed, Oct 30, 2013 at 3:57 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:\n> lg=!git log --pretty=format:'%h %ad %ae %s' --date=short | sed 's/@\\\\S*//g'\n>\n> should work.\n\n\nIt did! thanks! I didn't know that \"!sh -c\" is not needed\n\n>\n> On Wed, Oct 30, 2013 at 8:34 PM, Eugene Sajine <euguess@gmail.com> wrote:\n>> Hi,\n>>\n>> I need some advice about creating the git command alias:\n>>\n>> I have this as the command:\n>>\n>> git log --pretty=format:\"%h %ad %ae %s\" --date=short | sed 's/@\\S*//g'\n>>\n>>\n>> The purpose is to cut off the email domain and keep only username.\n>>\n>> I'm trying to create this as the alias:\n>>\n>>\n>> lg = !sh -c 'git log --pretty=format:\"%h %ad %ae %s\" --date=short |\n>> sed 's/@\\S*//g'' -\n>>\n>> but it complains about the \\S and i'm failing to come up with the\n>> escape sequence to make it work right.\n>>\n>> I know i can work around that by creating shell alias, but it is not\n>> what i would like to have.\n>>\n>> Any ideas?\n>>\n>> Thanks!\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"229864","messageId":"xmqq61sebhh3.fsf@gitster.dls.corp.google.com","threadId":"35249","inReplyTo":"CAPZPVFZ9WujUCQ1O9VfV83XUu_6g7Vp_MmYRCCO+GptOoSyvcg@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-30T21:02:00Z","receivedAt":"2013-10-30T21:02:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eugene Sajine <euguess@gmail.com> writes:\n\n> On Wed, Oct 30, 2013 at 3:57 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:\n>> lg=!git log --pretty=format:'%h %ad %ae %s' --date=short | sed 's/@\\\\S*//g'\n>>\n>> should work.\n>\n>\n> It did! thanks! I didn't know that \"!sh -c\" is not needed\n\n\"sh -c\" is often used when you pass arguments to your scriptlets,\ne.g. to allow\n\n\tgit lg master..next\n\nyou would want\n\n\tsh -c 'git log ... \"$@\" | sed ...' -\n\nso that\n\n\tgit lg master..next\n\nturns into\n\n\tsh -c 'git log ... \"$@\" | sed ...' - master..next\n\nwhich makes $1=\"master..next\" and fed to \"git log\".\n"},{"id":"229870","messageId":"CAPZPVFarK_jKpM2f62mErAmL+mck6EN1QPfHDHqqfJbJ2AfzXg@mail.gmail.com","threadId":"35249","inReplyTo":"xmqq61sebhh3.fsf@gitster.dls.corp.google.com","subject":"Re: Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-31T01:26:52Z","receivedAt":"2013-10-31T01:26:52Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Wed, Oct 30, 2013 at 5:02 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eugene Sajine <euguess@gmail.com> writes:\n>\n>> On Wed, Oct 30, 2013 at 3:57 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:\n>>> lg=!git log --pretty=format:'%h %ad %ae %s' --date=short | sed 's/@\\\\S*//g'\n>>>\n>>> should work.\n>>\n>>\n>> It did! thanks! I didn't know that \"!sh -c\" is not needed\n>\n> \"sh -c\" is often used when you pass arguments to your scriptlets,\n> e.g. to allow\n>\n>         git lg master..next\n>\n> you would want\n>\n>         sh -c 'git log ... \"$@\" | sed ...' -\n>\n> so that\n>\n>         git lg master..next\n>\n> turns into\n>\n>         sh -c 'git log ... \"$@\" | sed ...' - master..next\n>\n> which makes $1=\"master..next\" and fed to \"git log\".\n\nJunio,\n\nThat was my initial intention, because I would like to be able to pass\nparameters like to git log or git blame correctly without the explicit\nuse of $1. Could you please advise about how to make it work with the\n!sh -c ?\n\nBecause the same exact (sed 's/@\\\\S*//') syntax didn't work with \"sh -c\".\n\nThanks,\nEugene\n"},{"id":"229871","messageId":"xmqqk3gu9jst.fsf@gitster.dls.corp.google.com","threadId":"35249","inReplyTo":"CAPZPVFarK_jKpM2f62mErAmL+mck6EN1QPfHDHqqfJbJ2AfzXg@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-31T03:54:42Z","receivedAt":"2013-10-31T03:54:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eugene Sajine <euguess@gmail.com> writes:\n\n> That was my initial intention, because I would like to be able to pass\n> parameters like to git log or git blame correctly without the explicit\n> use of $1. Could you please advise about how to make it work with the\n> !sh -c ?\n>\n> Because the same exact (sed 's/@\\\\S*//') syntax didn't work with \"sh -c\".\n\nYou can make it work if you think step-by-step.  First, this is what\nyou want to run:\n\n\tsh -c 'git log --format=\"...\" \"$@\" | sed \"s/@\\S*//\"' -\n\nso that \"git euguess master..next\" would turn into\n\n\tsh -c 'git log --format=\"...\" \"$@\" | sed \"s/@\\S*//\"' - master..next\n\nNow, you want to wrap it into an alias, i.e.\n\n\t[alias]\n        \teuguess = \"!sh -c ...\"\n\nThat ... part is read by our configuration reader, so you need to\nquote the double quotes and backslashes with backslash, which would\ngive you something like:\n\n\t[alias]\n\t\teuguess = \"!sh -c 'git log --format=\\\"%h %ae %s\\\" --date=short \\\"$@\\\" | sed \\\"s/@\\\\S*//\\\"' -\"\n"},{"id":"229920","messageId":"CAPZPVFYFSBRHThO08LmuN_0fc55gYX-A+Y3=yA_MESko1t6fXQ@mail.gmail.com","threadId":"35249","inReplyTo":"xmqqk3gu9jst.fsf@gitster.dls.corp.google.com","subject":"Re: Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-31T15:36:59Z","receivedAt":"2013-10-31T15:36:59Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Wed, Oct 30, 2013 at 11:54 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eugene Sajine <euguess@gmail.com> writes:\n>\n>> That was my initial intention, because I would like to be able to pass\n>> parameters like to git log or git blame correctly without the explicit\n>> use of $1. Could you please advise about how to make it work with the\n>> !sh -c ?\n>>\n>> Because the same exact (sed 's/@\\\\S*//') syntax didn't work with \"sh -c\".\n>\n> You can make it work if you think step-by-step.  First, this is what\n> you want to run:\n>\n>         sh -c 'git log --format=\"...\" \"$@\" | sed \"s/@\\S*//\"' -\n>\n> so that \"git euguess master..next\" would turn into\n>\n>         sh -c 'git log --format=\"...\" \"$@\" | sed \"s/@\\S*//\"' - master..next\n>\n> Now, you want to wrap it into an alias, i.e.\n>\n>         [alias]\n>                 euguess = \"!sh -c ...\"\n>\n> That ... part is read by our configuration reader, so you need to\n> quote the double quotes and backslashes with backslash, which would\n> give you something like:\n>\n>         [alias]\n>                 euguess = \"!sh -c 'git log --format=\\\"%h %ae %s\\\" --date=short \\\"$@\\\" | sed \\\"s/@\\\\S*//\\\"' -\"\n>\n>\n\nJunio,\n\nThanks for taking the time - I appreciate that a lot.\nIt does work properly now except there is some difference between the\nrequired pathnames:\n\nwhen i'm in a subfolder in git repo i can say\n\ngit log filename\n\nBut it seems that if the alias is used i need to specify full path\nfrom the root of the repo no matter where i am.\n\ngit log a/b/c/filename\n\nthe difference is obviously in the working directory\n\nwhen i add an alias:\n\npd = \"!sh -c 'pwd'\"\n\ni get this:\n\n$ git pd\n/home/users/euguess/repo\n\n$ pwd\n/home/users/euguess/repo/a/b/c\n\nIs there any way to help that situation?\n\nThanks,\nEugene\n\nThanks,\nEugene\n"},{"id":"229926","messageId":"20131031174008.GA39079@gmail.com","threadId":"35249","inReplyTo":"CAPZPVFYFSBRHThO08LmuN_0fc55gYX-A+Y3=yA_MESko1t6fXQ@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-10-31T17:40:15Z","receivedAt":"2013-10-31T17:40:15Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Oct 31, 2013 at 11:36:59AM -0400, Eugene Sajine wrote:\n> On Wed, Oct 30, 2013 at 11:54 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> > Eugene Sajine <euguess@gmail.com> writes:\n> >\n> >> That was my initial intention, because I would like to be able to pass\n> >> parameters like to git log or git blame correctly without the explicit\n> >> use of $1. Could you please advise about how to make it work with the\n> >> !sh -c ?\n> >>\n> >> Because the same exact (sed 's/@\\\\S*//') syntax didn't work with \"sh -c\".\n> >\n> > You can make it work if you think step-by-step.  First, this is what\n> > you want to run:\n> >\n> >         sh -c 'git log --format=\"...\" \"$@\" | sed \"s/@\\S*//\"' -\n> >\n> > so that \"git euguess master..next\" would turn into\n> >\n> >         sh -c 'git log --format=\"...\" \"$@\" | sed \"s/@\\S*//\"' - master..next\n> >\n> > Now, you want to wrap it into an alias, i.e.\n> >\n> >         [alias]\n> >                 euguess = \"!sh -c ...\"\n> >\n> > That ... part is read by our configuration reader, so you need to\n> > quote the double quotes and backslashes with backslash, which would\n> > give you something like:\n> >\n> >         [alias]\n> >                 euguess = \"!sh -c 'git log --format=\\\"%h %ae %s\\\" --date=short \\\"$@\\\" | sed \\\"s/@\\\\S*//\\\"' -\"\n> >\n> >\n> \n> Junio,\n> \n> Thanks for taking the time - I appreciate that a lot.\n> It does work properly now except there is some difference between the\n> required pathnames:\n> \n> when i'm in a subfolder in git repo i can say\n> \n> git log filename\n> \n> But it seems that if the alias is used i need to specify full path\n> from the root of the repo no matter where i am.\n> \n> git log a/b/c/filename\n> \n> the difference is obviously in the working directory\n> \n> when i add an alias:\n> \n> pd = \"!sh -c 'pwd'\"\n> \n> i get this:\n> \n> $ git pd\n> /home/users/euguess/repo\n> \n> $ pwd\n> /home/users/euguess/repo/a/b/c\n> \n> Is there any way to help that situation?\n\nHere's the relevant details from Documentation/config.txt:\n\n\"\"\"\nIf the alias expansion is prefixed with an exclamation point,\nit will be treated as a shell command.  For example, defining\n\"alias.new = !gitk --all --not ORIG_HEAD\", the invocation\n\"git new\" is equivalent to running the shell command\n\"gitk --all --not ORIG_HEAD\".  Note that shell commands will be\nexecuted from the top-level directory of a repository, which may\nnot necessarily be the current directory.\n\n'GIT_PREFIX' is set as returned by running 'git rev-parse --show-prefix'\nfrom the original current directory. See linkgit:git-rev-parse[1].\n\"\"\"\n\nThe $GIT_PREFIX variable should be available to the alias; it is\na path relative to the root which corresponds to the current\ndirectory.\n\nThat doesn't quite play well with these aliases because they use\n\"$@\", though.\n\nOne way to do it is to add another layer of indirection.  Maybe\nsomeone else on this list has a better suggestion, but this\nshould do the trick...\n\nCreate a shell script to contain your alias, and then point\nyour alias at it.  e.g.\n\n[alias]\n\texample = \"!/path/to/alias-script \\\"$@\\\"\"\n\nand then the script can look like:\n\n#!/bin/sh\n\nunset CDPATH\nif test -n \"$GIT_PREFIX\"\nthen\n\tcd \"$GIT_PREFIX\"\nfi\ngit log --format='%h %ae %s' --date=short \"$@\" | sed 's/@\\\\S*//'\n\n\n...or something like that.  I hope that helps.\nI'm also curious if there's a way to avoid needing the extra script...\n\n...\n\nA-ha.. I think adding the chdir to alias is possible using a function.\n\n[alias]\n\texample = \"!f() { cd \\\"${GIT_PREFIX:-.}\\\" && git log \\\"$@\\\"; }; f\"\n\nDoes that work for you?\nI hope that helps.\n\ncheers,\n-- \nDavid\n"},{"id":"229930","messageId":"xmqqd2ml8gbs.fsf@gitster.dls.corp.google.com","threadId":"35249","inReplyTo":"20131031174008.GA39079@gmail.com","subject":"Re: Help creating git alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-31T18:07:19Z","receivedAt":"2013-10-31T18:07:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> A-ha.. I think adding the chdir to alias is possible using a function.\n\nYou do not have to use a function to do so, no?\n"},{"id":"229936","messageId":"20131031181509.GB39079@gmail.com","threadId":"35249","inReplyTo":"xmqqd2ml8gbs.fsf@gitster.dls.corp.google.com","subject":"Re: Help creating git alias","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-10-31T18:15:10Z","receivedAt":"2013-10-31T18:15:10Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Oct 31, 2013 at 11:07:19AM -0700, Junio C Hamano wrote:\n> David Aguilar <davvid@gmail.com> writes:\n> \n> > A-ha.. I think adding the chdir to alias is possible using a function.\n> \n> You do not have to use a function to do so, no?\n\nRight, of course.\n\nSo something like:\n\n[alias]\n\texample = \"!cd ${GIT_PREFIX:-.} && git log \\\"$@\\\"\"\n\nshould do the trick.\n-- \nDavid\n"},{"id":"229957","messageId":"CAPZPVFYWf3_xtxKkdw4_gzqKagVsbNvj73cb=RvX1Zm0C1h8pQ@mail.gmail.com","threadId":"35249","inReplyTo":"20131031181509.GB39079@gmail.com","subject":"Re: Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-31T19:31:08Z","receivedAt":"2013-10-31T19:31:08Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Thu, Oct 31, 2013 at 2:15 PM, David Aguilar <davvid@gmail.com> wrote:\n> On Thu, Oct 31, 2013 at 11:07:19AM -0700, Junio C Hamano wrote:\n>> David Aguilar <davvid@gmail.com> writes:\n>>\n>> > A-ha.. I think adding the chdir to alias is possible using a function.\n>>\n>> You do not have to use a function to do so, no?\n>\n> Right, of course.\n>\n> So something like:\n>\n> [alias]\n>         example = \"!cd ${GIT_PREFIX:-.} && git log \\\"$@\\\"\"\n>\n> should do the trick.\n> --\n> David\n\n\nAwesome! It does work!\nOne note: i tried the ${GIT_PREFIX:-.}  and ${GIT_PREFIX} and it seems\nto give the same results. What is the expected difference here?\n\nThank you!\n"},{"id":"229961","messageId":"xmqq7gct5iu1.fsf@gitster.dls.corp.google.com","threadId":"35249","inReplyTo":"CAPZPVFYWf3_xtxKkdw4_gzqKagVsbNvj73cb=RvX1Zm0C1h8pQ@mail.gmail.com","subject":"Re: Help creating git alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-31T19:41:26Z","receivedAt":"2013-10-31T19:41:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eugene Sajine <euguess@gmail.com> writes:\n\n> One note: i tried the ${GIT_PREFIX:-.}  and ${GIT_PREFIX} and it seems\n> to give the same results. What is the expected difference here?\n\nGIT_PREFIX may be an empty string when you run from the top-level,\nin which case you would end up with \"cd && ...\" and end up working\nin your $HOME.\n"},{"id":"229968","messageId":"CAPZPVFaFQrEdr7EN3a=ds2T_C87sct6ksH2SbjEg=43-ZNt6Jg@mail.gmail.com","threadId":"35249","inReplyTo":"xmqq7gct5iu1.fsf@gitster.dls.corp.google.com","subject":"Re: Help creating git alias","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2013-10-31T20:06:43Z","receivedAt":"2013-10-31T20:06:43Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Thu, Oct 31, 2013 at 3:41 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eugene Sajine <euguess@gmail.com> writes:\n>\n>> One note: i tried the ${GIT_PREFIX:-.}  and ${GIT_PREFIX} and it seems\n>> to give the same results. What is the expected difference here?\n>\n> GIT_PREFIX may be an empty string when you run from the top-level,\n> in which case you would end up with \"cd && ...\" and end up working\n> in your $HOME.\n>\n\n\ngot it! thank you!\n\nEugene\n"}]}