All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Bryan Turner <bturner@atlassian.com>
Cc: git@vger.kernel.org
Subject: Re: Question: git clone --no-checkout behavior
Date: Thu, 12 Jul 2012 10:40:32 -0700	[thread overview]
Message-ID: <7vliioc1yn.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAGyf7-EZOSiATo3yF5x+FT6_QAkMTJ+AmrE27kwmxLkLXdaJKg@mail.gmail.com> (Bryan Turner's message of "Thu, 12 Jul 2012 22:51:31 +1000")

Bryan Turner <bturner@atlassian.com> writes:

> I've witnessed the following behavior in both git 1.7.6 and 1.7.10.4.
>
> Assume I have a bare clone, some-repo.git. If I run:
> - git clone --shared --no-checkout /path/to/some-repo.git shared-repo
> - cd shared-repo
> - git status

I do not recall we *designed* it in such a way that you would commit
an empty tree if you run "git commit" immediately after making such
a clone.  But I do not think it is a bug, either.

I think the most likely reason nobody even noticed this is because
the expected use scenario for --no-checkout is when user does not
know (and does not care to find out) what branch is checked out (if
nonbare) or marked as the primary (if bare) in the repository she is
cloning from, and will checkout the branch she wants to work on
immediately after cloning, i.e.

	git clone -n $over_there here
        cd here
	# she knows she wants to fork from 'nitfol'
        git checkout -t -b frotz origin/nitfol

Not having anything in the $GIT_DIR/index (which is why you see
"everything is removed from the index, you will commit an empty
tree" in the status output) does not matter in this scenario,
because the first command she invokes will be "git checkout".

If you populated $GIT_DIR/index from the tree of HEAD, you would see
everything is deleted in the working tree.  You can simulate it by
doing this:

	git clone -n $over_there here
        cd here
	git read-tree HEAD
	git status

But it would not help people who want to check another branch out
immediately after cloning with -n, which is the whole point of the
option, so...

  reply	other threads:[~2012-07-12 17:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 12:51 Question: git clone --no-checkout behavior Bryan Turner
2012-07-12 17:40 ` Junio C Hamano [this message]
     [not found]   ` <CAGyf7-Fkn9bjJ9EZEFNsba8U-RUzrB3TzmB-YbcvwUFRbHXG+Q@mail.gmail.com>
2012-07-12 22:02     ` Junio C Hamano

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=7vliioc1yn.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bturner@atlassian.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.