git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] push: fail early with detached HEAD and current

From
Junio C Hamano <gitster@pobox.com>
Date
May 29, 2013, 19:59 UTC
Message-ID
<7v7gihsgjr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0mCY0F-EgO6hQv-LvV1Nb5H9jNXBWLDrY07rVNqLBPjkw@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 15 quoted lines
> Junio C Hamano wrote:
>>>       case PUSH_DEFAULT_CURRENT:
>>> +             if (!branch)
>>> +                     die(_(message_detached_head_die), remote->name);
>>>               add_refspec("HEAD");
>>>               break;
>>
>> Would it hurt to do
>>
>>         if (!branch_get(NULL))
>>                 die(...);
>>
>> here, without the first hunk?
>
> And how would I change the add_refspec() call to take branch->name in [3/3]?
By doing something like this, perhaps?
	struct ... branch;
        switch (...) {
        ...
        case it-only-matters-here:
        	branch = branch_get(NULL);
                if (!branch)
			die(...);
	}
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 6 of 8 in “Early HEAD resolution in push.default = current”
  1. 0/3 Early HEAD resolution in push.default = currentRamkumar Ramachandra, May 29, 2013
  2. 1/3 push: factor out the detached HEAD error messageRamkumar Ramachandra, May 29, 2013
  3. 2/3 push: fail early with detached HEAD and currentRamkumar Ramachandra, May 29, 2013
  4. Junio C HamanoMay 29, 2013
  5. Ramkumar RamachandraMay 29, 2013
  6. Junio C HamanoMay 29, 2013
  7. Ramkumar RamachandraMay 29, 2013
  8. 3/3 push: make push.default = current use resolved HEADRamkumar Ramachandra, May 29, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.