{"thread":{"id":"27220","subject":"[RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","startedAt":"2011-04-29T15:53:15Z","lastAt":"2011-05-07T02:24:04Z","messageCount":17,"participants":["Michael J Gruber","Junio C Hamano","Jeff King","Sverre Rabbelier","Andreas Schwab","Matthieu Moy","Mikael Magnusson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"166740","messageId":"6c53916752bf79178113157291fd675ead0804c9.1304092338.git.git@drmicha.warpmail.net","threadId":"27220","inReplyTo":null,"subject":"[RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-29T15:53:15Z","receivedAt":"2011-04-29T15:53:15Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"HEAD~n is often used for rebase invocations etc. Make it use the same\ndefault we use in other places, i.e. ~n == HEAD~n.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nI haven't checked the side effects but find this super useful. Stop\nme right now if this is a bad idea...\n\nAn alternative patch subject for this would have been:\n\nsha1_name: We don't need no hg revision numbers, stupid!\n---\n sha1_name.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 69cd6c8..5d52eac 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -480,7 +480,10 @@ static int get_nth_ancestor(const char *name, int len,\n \tstruct commit *commit;\n \tint ret;\n \n-\tret = get_sha1_1(name, len, sha1);\n+\tif (len)\n+\t\tret = get_sha1_1(name, len, sha1);\n+\telse\n+\t\tret = get_sha1(\"HEAD\", sha1);\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(sha1);\n-- \n1.7.5.250.g4493b\n"},{"id":"166744","messageId":"7vfwp1yqnq.fsf@alter.siamese.dyndns.org","threadId":"27220","inReplyTo":"6c53916752bf79178113157291fd675ead0804c9.1304092338.git.git@drmicha.warpmail.net","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-29T16:21:29Z","receivedAt":"2011-04-29T16:21:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> HEAD~n is often used for rebase invocations etc.\n\nI thought rebase invocations these days use @{u}.\n"},{"id":"166780","messageId":"20110429223433.GA3434@sigill.intra.peff.net","threadId":"27220","inReplyTo":"6c53916752bf79178113157291fd675ead0804c9.1304092338.git.git@drmicha.warpmail.net","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-29T22:34:33Z","receivedAt":"2011-04-29T22:34:33Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 29, 2011 at 05:53:15PM +0200, Michael J Gruber wrote:\n\n> HEAD~n is often used for rebase invocations etc. Make it use the same\n> default we use in other places, i.e. ~n == HEAD~n.\n\nHmm. It certainly makes sense in that we often default emptiness to\nHEAD, but I don't think we can extend this syntax to other things. For\nexample, seeing ~n makes me think that ^n or ^{tree} would work. But of\ncourse \"^\" at the beginning of a ref means something completely\ndifferent. So it's not completely consistent.\n\nConsistency-wise, I'm not sure if it makes things better or worse.\nObviously we have \"foo..\" with an implicit HEAD. You could argue that\n\"..\" is a different operator altogether, and that any operator that is a\n\"ref modifier\" like \"~\" or \"^\" needs to have a non-implicit ref. But\nthat gets muddier with \"@{4.hours.ago}\", which also takes an implicit\nvalue, except that it isn't exactly HEAD. It's the branch pointed to by\nHEAD.\n\nSo there really isn't a lot of consistency, I guess.  It also conflicts\na little with the shell's \"~user\" syntax, though presumably you don't\nhave users named \"1\" and \"2\".\n\n-Peff\n"},{"id":"166791","messageId":"BANLkTi=7_-TF63Y9MRHZ_XirSUD6RAC9kw@mail.gmail.com","threadId":"27220","inReplyTo":"20110429223433.GA3434@sigill.intra.peff.net","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-04-29T23:23:55Z","receivedAt":"2011-04-29T23:23:55Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Apr 30, 2011 at 00:34, Jeff King <peff@peff.net> wrote:\n> So there really isn't a lot of consistency, I guess.  It also conflicts\n> a little with the shell's \"~user\" syntax, though presumably you don't\n> have users named \"1\" and \"2\".\n\nFWIW, I like the patch, mainly because I dislike typing HEAD~n (I\nusually mispel it as HEA~n) and agree with peff's analysis, we're such\na long way from being any form of consistent that I don't see this\nbreaking any user expectations.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"166792","messageId":"m2k4ecy6rv.fsf@igel.home","threadId":"27220","inReplyTo":"20110429223433.GA3434@sigill.intra.peff.net","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-04-29T23:31:00Z","receivedAt":"2011-04-29T23:31:00Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> It also conflicts a little with the shell's \"~user\" syntax, though\n> presumably you don't have users named \"1\" and \"2\".\n\nWell, you sorta do if you did use pushd.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"166796","messageId":"7vfwp0uwu4.fsf@alter.siamese.dyndns.org","threadId":"27220","inReplyTo":"m2k4ecy6rv.fsf@igel.home","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-30T05:33:55Z","receivedAt":"2011-04-30T05:33:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> Jeff King <peff@peff.net> writes:\n>\n>> It also conflicts a little with the shell's \"~user\" syntax, though\n>> presumably you don't have users named \"1\" and \"2\".\n>\n> Well, you sorta do if you did use pushd.\n\nYeah, I was also worried about that.  Or some arcane system\nmisinterpreting \"~0\" as the home directory of root ;-)\n"},{"id":"166798","messageId":"m21v0kw1es.fsf@igel.home","threadId":"27220","inReplyTo":"7vfwp0uwu4.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-04-30T09:09:47Z","receivedAt":"2011-04-30T09:09:47Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Andreas Schwab <schwab@linux-m68k.org> writes:\n>\n>> Jeff King <peff@peff.net> writes:\n>>\n>>> It also conflicts a little with the shell's \"~user\" syntax, though\n>>> presumably you don't have users named \"1\" and \"2\".\n>>\n>> Well, you sorta do if you did use pushd.\n>\n> Yeah, I was also worried about that.  Or some arcane system\n> misinterpreting \"~0\" as the home directory of root ;-)\n\nOn non-arcane systems ~0 is expanded to the current directory.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"166812","messageId":"1304238652.9638.1446946253@webmail.messagingengine.com","threadId":"27220","inReplyTo":"7vfwp1yqnq.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-01T08:30:52Z","receivedAt":"2011-05-01T08:30:52Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"On Fri, 29 Apr 2011 09:21 -0700, \"Junio C Hamano\" <gitster@pobox.com>\nwrote:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n> > HEAD~n is often used for rebase invocations etc.\n> \n> I thought rebase invocations these days use @{u}.\n> \n\nI meant \"rebase -i\", sorry. And in fact I mostly mean those cases where\nI want to \"amend\" a commit which is not the top most one.\n\nMichael\n"},{"id":"166813","messageId":"vpqoc3mg5bd.fsf@bauges.imag.fr","threadId":"27220","inReplyTo":"1304238652.9638.1446946253@webmail.messagingengine.com","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-05-01T09:04:22Z","receivedAt":"2011-05-01T09:04:22Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"\"Michael J Gruber\" <git@drmicha.warpmail.net> writes:\n\n> On Fri, 29 Apr 2011 09:21 -0700, \"Junio C Hamano\" <gitster@pobox.com>\n> wrote:\n>> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>> \n>> > HEAD~n is often used for rebase invocations etc.\n>> \n>> I thought rebase invocations these days use @{u}.\n>> \n>\n> I meant \"rebase -i\", sorry. And in fact I mostly mean those cases where\n> I want to \"amend\" a commit which is not the top most one.\n>\n> Michael\n\n... and Junio is right that\n\n  git rebase -i @{u}\n\nusually does the right thing: let you amend any of the unpushed commits.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"166819","messageId":"7vfwoys20u.fsf@alter.siamese.dyndns.org","threadId":"27220","inReplyTo":"1304238652.9638.1446946253@webmail.messagingengine.com","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-01T18:34:41Z","receivedAt":"2011-05-01T18:34:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael J Gruber\" <git@drmicha.warpmail.net> writes:\n\n> I meant \"rebase -i\", sorry. And in fact I mostly mean those cases where\n> I want to \"amend\" a commit which is not the top most one.\n\nI also see myself getting tempted to say \"rebase -i -2\" every once in a\nwhile; it seems to go well with \"log -2\" especially when the history is\nlinear.\n"},{"id":"166823","messageId":"vpqsjsy15i0.fsf@bauges.imag.fr","threadId":"27220","inReplyTo":"7vfwoys20u.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-05-01T21:21:43Z","receivedAt":"2011-05-01T21:21:43Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Michael J Gruber\" <git@drmicha.warpmail.net> writes:\n>\n>> I meant \"rebase -i\", sorry. And in fact I mostly mean those cases where\n>> I want to \"amend\" a commit which is not the top most one.\n>\n> I also see myself getting tempted to say \"rebase -i -2\" every once in a\n> while; it seems to go well with \"log -2\" especially when the history is\n> linear.\n\nI like that. As easy to type (or more, depending on the keyboard) as ~2,\nbut no nasty interaction with the shell. OTOH, that would be a\nspecial-case for rebase only (i.e. doesn't make \"git show HEAD~2\" easier\nto type), but that's the most common case.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"166843","messageId":"4DBE6E77.3030703@drmicha.warpmail.net","threadId":"27220","inReplyTo":"m21v0kw1es.fsf@igel.home","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-02T08:42:31Z","receivedAt":"2011-05-02T08:42:31Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Andreas Schwab venit, vidit, dixit 30.04.2011 11:09:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> Andreas Schwab <schwab@linux-m68k.org> writes:\n>>\n>>> Jeff King <peff@peff.net> writes:\n>>>\n>>>> It also conflicts a little with the shell's \"~user\" syntax, though\n>>>> presumably you don't have users named \"1\" and \"2\".\n>>>\n>>> Well, you sorta do if you did use pushd.\n>>\n>> Yeah, I was also worried about that.  Or some arcane system\n>> misinterpreting \"~0\" as the home directory of root ;-)\n> \n> On non-arcane systems ~0 is expanded to the current directory.\n> \n> Andreas.\n> \n[cumulative reply :)]\n\nWhile we could use a short-hand for HEAD also I don't think ~0 really is\na concern.\n\nRegarding consistency:\nWe try to have reasonable defaults and try to dwim (which are different\nthings) even if that breaks consistency/systematics, because\nuseful/reasonable and \"what I mean\" depend on the context.\n\n\"^\" resp. \"..\" and \"...\" are ambiguous and cannot be resolved easily\nbecause for most commands they can mean two things resp. require two\narguments. (\"..\" and \"...\" could maybe default do \"@{u}..HEAD\" etc.)\n\n\"~<n>\" can only take a revision argument to its left, and also it needs\nan argument to its left (as opposed to \"^\"). Therefore we can default it\nunambiguously and without braking any current usage (that I know of).\n\nRegarding rebase -i -<n>:\ngit-rebase (-i) does not have a log/rev-list like interface at all (just\nlike git-cherry does not), and introducing an argument which looks like\nit did would just increase the user confusion, I'm afraid.\n\nMichael\n"},{"id":"166845","messageId":"4DBE8FD8.90303@drmicha.warpmail.net","threadId":"27220","inReplyTo":"BANLkTinxszGhtYobuvci5Yi8eTHW+pi2wA@mail.gmail.com","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-02T11:04:56Z","receivedAt":"2011-05-02T11:04:56Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 02.05.2011 12:25:\n> \n> On May 2, 2011 1:42 AM, \"Michael J Gruber\" <git@drmicha.warpmail.net\n> <mailto:git@drmicha.warpmail.net>> wrote:\n> \n>> Regarding rebase -i -<n>:\n>> git-rebase (-i) does not have a log/rev-list like interface at all (just\n>> like git-cherry does not), and introducing an argument which looks like\n>> it did would just increase the user confusion, I'm afraid.\n> \n> That cuts both ways. Some people can already be confused by it not being\n> in line with the log family. Just like format-patch that was born\n> without the log family interface later learned it, it is not impossible\n> to teach rebase the same, no?\n> \n\nJust because we went in a wrong direction then, is it good to go in the\nsame direction now?\n\nI'm not saying it necessarily was a wrong direction, I just don't\nconsider that an argument.\n\nYou can consider my \"log --cherry\" being part of a long time plan to git\nrid of \"kinda-loggish but not log-like\" command interfaces (in that case\ngit-cherry).\n\nIntroducing a shortcut ~n for HEAD~n does not introduce new\ninconsistencies (it's a shortcut for a commit, for every command which\ntakes a commit) - and does not contradict introducing -n at all, btw.\nBut introducing -n means introducing a range like revision argument to a\ncommand which does not grok ranges at all, so that is a much deeper\ndecision.\n\nMichael\n"},{"id":"166883","messageId":"7v7ha9ngsf.fsf@alter.siamese.dyndns.org","threadId":"27220","inReplyTo":"4DBE8FD8.90303@drmicha.warpmail.net","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-02T16:33:02Z","receivedAt":"2011-05-02T16:33:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Introducing a shortcut ~n for HEAD~n does not introduce new\n> inconsistencies (it's a shortcut for a commit, for every command which\n> takes a commit) - and does not contradict introducing -n at all, btw.\n\nI thought we already ruled out ~n because many shells think ~n is a path.\n\n> But introducing -n means introducing a range like revision argument to a\n> command which does not grok ranges at all, so that is a much deeper\n> decision.\n\nI do not think so.\n\nWhen I originally wrote format-patch and rebase, Linus was finishing up\nmaking the \"range notation\" easier to use around rev-list (and later log).\nIt was not apparent to me that what these two commands operated were a\nrange, by deviating from the \"log\" syntax two commands could take their\noperand in a more workflow-specific way (which in turn led to a shorter\nkeystrokes, as you only wrote only one endpoint because the other end was\nimplicit).\n\nThe original syntax of format-patch (which by the way is still supported)\nis to give what we call the upstream these days, like this:\n\n\tgit format-patch origin\n\nwhich then is internally turned into a moral equivalent of\n\n\tgit rev-list --no-merges origin..HEAD\n\nto find out which commit to output (and run \"git diff-tree -p --stdin\"\non).  The command originally only accepted this short-hand form without\ngiving the users ways to affect underlying \"range\" any other way.  But\nlater we found that it is better allow users to use the \"log\" syntax, for\nreasons including:\n\n - HEAD may not always be the topic you want to submit; and\n - you may not want to submit all commits since the fork point\n   (i.e. endpoint might want to be HEAD~4 or mytopic~3).\n\nThe history behind \"rebase\" is pretty similar.  Again, with the original\nsyntax you give the \"upstream\":\n\n\tgit rebase origin\n\tgit rebase origin mytopic\n\nand again these were internally turned into a moral equivalent of\n\n\t... optionally \"git checkout mytopic\" if given\n\tgit rev-list --no-merges origin..HEAD\n\nto find out which commit to replay on top of the updated base (this is a\nnatural consequence that the original \"rebase\" was \"format-patch\" piped\ninto \"am\").\n\n\"git rebase origin..\" and \"git rebase origin..mytopic\" would be a way to\nexpress this operation more naturally.  The former would rebase the\ncurrent branch, and the latter would checkout mytopic branch and rebase\nit.\n\nOne extra reason (which does not apply to format-patch) that rebase wasn't\ndone that way was purely technical.  Back then, unless you are prepared to\nparse these range arguments yourself, once you feed them to rev-parse\nmachinery, you wouldn't be able to tell if the user said \"origin..mytopic\"\nor \"origin..mytopic^0\".  The former should rebuild mytopic branch while\nthe latter should leave mytopic branch intact and instead give you a\nrebuilt history for mytopic branch on a detached HEAD.\n\nI think these days the internal rev-parse machinery passes enough\ninformation down add_pending_object() codepath (and in a scripted\nPorcelain, you can say \"rev-parse --symbolic origin..HEAD\" to pry it\napart), so it should be possible to express what range \"rebase\" wants to\noperate on in its natural notation that is used by the log family of\ncommands, if we wanted to.\n"},{"id":"166885","messageId":"4DBEEEAA.3000004@drmicha.warpmail.net","threadId":"27220","inReplyTo":"7v7ha9ngsf.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-02T17:49:30Z","receivedAt":"2011-05-02T17:49:30Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 02.05.2011 18:33:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> Introducing a shortcut ~n for HEAD~n does not introduce new\n>> inconsistencies (it's a shortcut for a commit, for every command which\n>> takes a commit) - and does not contradict introducing -n at all, btw.\n> \n> I thought we already ruled out ~n because many shells think ~n is a path.\n\nYou have, apparently ;)\n\nunquoted ~0 conflicts, but unquoted ~n conflicts only when you use pushd\n(and the stack has n entries; or n+-1, I can't count either...). Even\n\\~2 is shorter than HEAD~2, btw., although I don't consider that viable.\n\nBut I understand that I'll have to leave ~n for my private edition.\n\nMichael\n"},{"id":"166904","messageId":"vpq62pssvun.fsf@bauges.imag.fr","threadId":"27220","inReplyTo":"4DBEEEAA.3000004@drmicha.warpmail.net","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-05-02T20:14:56Z","receivedAt":"2011-05-02T20:14:56Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n>> I thought we already ruled out ~n because many shells think ~n is a path.\n>\n> You have, apparently ;)\n>\n> unquoted ~0 conflicts, but unquoted ~n conflicts only when you use pushd\n> (and the stack has n entries; or n+-1, I can't count either...).\n\nThe problem is that it makes the behavior rather unpredictible for\nnon-expert:\n\ngit log ~2 # great\npushd\ngit log ~2 # still great\npushd\ngit log ~2 # WTF ?\n\nso we can't teach new users the ~N syntax without quoting if we don't\nwant them to get bad surprises later. \\~N is not terribly bad, but I\ndon't think it has a big added value compared to HEAD~N.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"167306","messageId":"BANLkTinsWpXYN+Zejph6toidZWFAkprcYw@mail.gmail.com","threadId":"27220","inReplyTo":"BANLkTi=7_-TF63Y9MRHZ_XirSUD6RAC9kw@mail.gmail.com","subject":"Re: [RFC/largely untested/PATCH] sha1_name: interpret ~n as HEAD~n","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2011-05-07T02:24:04Z","receivedAt":"2011-05-07T02:24:04Z","isPatch":true,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"On 30 April 2011 01:23, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Heya,\n>\n> On Sat, Apr 30, 2011 at 00:34, Jeff King <peff@peff.net> wrote:\n>> So there really isn't a lot of consistency, I guess.  It also conflicts\n>> a little with the shell's \"~user\" syntax, though presumably you don't\n>> have users named \"1\" and \"2\".\n>\n> FWIW, I like the patch, mainly because I dislike typing HEAD~n (I\n> usually mispel it as HEA~n) and agree with peff's analysis, we're such\n> a long way from being any form of consistent that I don't see this\n> breaking any user expectations.\n\nSomething I always set up in the skeleton dir\n($prefix/share/git-core/templates) after installing git is\necho 'ref: HEAD' > h\nit makes life so much easier :).\n\n-- \nMikael Magnusson\n"}]}