{"thread":{"id":"12773","subject":"Invalid refspec?","startedAt":"2008-03-20T10:53:31Z","lastAt":"2008-03-20T19:08:47Z","messageCount":5,"participants":["Samuel Tardieu","Daniel Barkalow","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72504","messageId":"2008-03-20-11-53-31+trackit+sam@rfc1149.net","threadId":"12773","inReplyTo":null,"subject":"Invalid refspec?","fromName":"Samuel Tardieu","fromEmail":"sam@rfc1149.net","sentAt":"2008-03-20T10:53:31Z","receivedAt":"2008-03-20T10:53:31Z","isPatch":false,"sender":{"key":"sam@rfc1149.net","avatar":"https://avatars.githubusercontent.com/u/44656?v=4"},"body":"I am using git master branch locally (1.5.5.rc0.133.g7e207), and the\nserver is using 1.5.4.rc3.g16335. I want to push my HEAD~1 revision\ninto the 2.0 branch on the server, and it looks like it is not\nexpanded anymore in the refspec:\n\n% git push origin HEAD~1:2.0\nfatal: Invalid refspec 'HEAD~1:2.0'\nfatal: The remote end hung up unexpectedly\n\nIsn't HEAD~1 supposed to be expanded locally? Using the SHA-1 instead\nof HEAD~1 works fine.\n\n  Sam\n-- \nSamuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/\n"},{"id":"72511","messageId":"alpine.LNX.1.00.0803200914420.19665@iabervon.org","threadId":"12773","inReplyTo":"2008-03-20-11-53-31+trackit+sam@rfc1149.net","subject":"Re: Invalid refspec?","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-03-20T13:21:18Z","receivedAt":"2008-03-20T13:21:18Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Thu, 20 Mar 2008, Samuel Tardieu wrote:\n\n> I am using git master branch locally (1.5.5.rc0.133.g7e207), and the\n> server is using 1.5.4.rc3.g16335. I want to push my HEAD~1 revision\n> into the 2.0 branch on the server, and it looks like it is not\n> expanded anymore in the refspec:\n> \n> % git push origin HEAD~1:2.0\n> fatal: Invalid refspec 'HEAD~1:2.0'\n> fatal: The remote end hung up unexpectedly\n> \n> Isn't HEAD~1 supposed to be expanded locally? Using the SHA-1 instead\n> of HEAD~1 works fine.\n\nAh, yes. I added checks for invalid refspecs, and missed that you can use \nthings that are invalid as ref names but valid as object names.\n\nWe need a test for the src being an object name around line 443 in \nremote.c; I'll have something this evening if nobody beats me to it. For \nnow, you can comment out line 444 (except for a semicolon) to disable the \ncheck that's in your way.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"72525","messageId":"7vy78dwdh2.fsf@gitster.siamese.dyndns.org","threadId":"12773","inReplyTo":"alpine.LNX.1.00.0803200914420.19665@iabervon.org","subject":"Re: Invalid refspec?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-20T16:46:01Z","receivedAt":"2008-03-20T16:46:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> We need a test for the src being an object name around line 443 in \n> remote.c; I'll have something this evening if nobody beats me to it.\n\nCareful.  That is ONLY valid for pushes.  For fetches, you are allowed to\nname existing refs and nothing else.\n"},{"id":"72531","messageId":"alpine.LNX.1.00.0803201256080.19665@iabervon.org","threadId":"12773","inReplyTo":"7vy78dwdh2.fsf@gitster.siamese.dyndns.org","subject":"Re: Invalid refspec?","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-03-20T17:12:38Z","receivedAt":"2008-03-20T17:12:38Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Thu, 20 Mar 2008, Junio C Hamano wrote:\n\n> Daniel Barkalow <barkalow@iabervon.org> writes:\n> \n> > We need a test for the src being an object name around line 443 in \n> > remote.c; I'll have something this evening if nobody beats me to it.\n> \n> Careful.  That is ONLY valid for pushes.  For fetches, you are allowed to\n> name existing refs and nothing else.\n\nI think it's okay to make \"HEAD~1:foo\" *valid* a fetch refspec; it'll be \nrejected a bit further along, but there's no particular need to give a \ndifferent error for \"HEAD~1:foo\" versus \n\"e83c5163316f89bfbde7d9ab23ca2e25604af290:foo\" based on the presence of a \n~. Sure, we can figure out a little bit earlier that it's not going to \nwork, but I don't think that's really enough to make it important that \nparse_ref_spec reject it.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"72535","messageId":"7vhcf1w6v4.fsf@gitster.siamese.dyndns.org","threadId":"12773","inReplyTo":"alpine.LNX.1.00.0803201256080.19665@iabervon.org","subject":"Re: Invalid refspec?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-20T19:08:47Z","receivedAt":"2008-03-20T19:08:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> ... but there's no particular need to give a \n> different error for \"HEAD~1:foo\" versus \n> \"e83c5163316f89bfbde7d9ab23ca2e25604af290:foo\" based on the presence of a \n> ~.\n\nThis is a valid argument in that e83c51... could be (and currently has to\nbe) a ref name in a fetch refspec.\n\nBut we still need to reject something like \"HEAD**1:foo\".\n"}]}