public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail•com>
To: Taylor Blau <me@ttaylorr•com>
Cc: Abhijeet Sonar <abhijeet.nkt@gmail•com>,  git@vger•kernel.org
Subject: Re: Why is pushing to stash not allowed without an initial commit?
Date: Thu, 17 Oct 2024 23:50:49 +0300	[thread overview]
Message-ID: <87msj2a1xy.fsf@osv.gnss.ru> (raw)
In-Reply-To: <ZxFe/cEI0SzFMSi0@nand.local> (Taylor Blau's message of "Thu, 17 Oct 2024 15:01:17 -0400")

Taylor Blau <me@ttaylorr•com> writes:

> On Thu, Oct 17, 2024 at 08:51:29PM +0530, Abhijeet Sonar wrote:
>> I see that the stash commit has two parents: the initial commit and the
>> commit that actually holds the files that were stashed.
>>
>> If git were to allow a stash entry with no initial commit, it would have to
>> create a stash commit with only one parent (i.e. the commit labeled with
>> 'index on <branch>'). I wonder if there is a reason this would be bad and
>> therefore not allowed?
>
> Right, each stash entry has two parents:
>
>   - The first parent is the state of HEAD in your repository when you
>     created the stash entry,
>
>   - The second parent is the state of the index at the same point
>
> So there would be no reasonable value to substitute in for the first
> parent in the case where your repository does not yet have any
> commits.

I still wonder why Git has no concept of the ultimate null-commit from
which all the Git world descends? Looks like it'd help to have one to
handle such corner cases gracefully. Was it just an oversight of
original design that isn't worth fixing already?

-- 
Sergey

      reply	other threads:[~2024-10-17 20:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 15:21 Why is pushing to stash not allowed without an initial commit? Abhijeet Sonar
2024-10-17 19:01 ` Taylor Blau
2024-10-17 20:50   ` Sergey Organov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msj2a1xy.fsf@osv.gnss.ru \
    --to=sorganov@gmail$(echo .)com \
    --cc=abhijeet.nkt@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=me@ttaylorr$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox