git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [WIP PATCH 1/4] Prepare checkout_entry() for recursive checkout of submodules
Date: Fri, 09 Apr 2010 14:59:51 -0700	[thread overview]
Message-ID: <7vd3y81e3s.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4BBF9DC9.8030905@web.de> (Jens Lehmann's message of "Fri\, 09 Apr 2010 23\:36\:09 +0200")

Jens Lehmann <Jens.Lehmann@web.de> writes:

> +int checkout_submodule(const char *path, const unsigned char sha1[20], int force)
> +{
> +	struct strbuf buf = STRBUF_INIT;
> +	struct child_process cp;
> +	const char *hex_sha1 = sha1_to_hex(sha1);
> +	const char *argv[] = {
> +		"checkout",
> +                force ? "-qf" : "-q",
> +		hex_sha1,
> +		NULL,
> +	};

Why force -q?

> +	strbuf_addf(&buf, "%s/.git/", path);
> +	if (!is_directory(buf.buf)) {
> +		strbuf_release(&buf);
> +		/* The submodule is not populated, so we can't check it out */
> +		return 0;
> +	}

This would give you an incorrect result if .git is a file that records
"gitdir: overthere" (see read_gitfile_gently() in setup.c); I would expect
it would become a fairly important ingredient if we ever enhance the
submodule support to add submodule that disappears/reappears in the
history.

  reply	other threads:[~2010-04-09 22:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 21:34 [WIP PATCH 0/4] Recursively checkout submodules Jens Lehmann
2010-04-09 21:36 ` [WIP PATCH 1/4] Prepare checkout_entry() for recursive checkout of submodules Jens Lehmann
2010-04-09 21:59   ` Junio C Hamano [this message]
2010-04-09 23:11     ` Jens Lehmann
2010-04-10 17:01       ` Jens Lehmann
2010-04-10 18:44         ` Junio C Hamano
2010-04-10 20:57           ` Jens Lehmann
2010-04-09 21:37 ` [WIP PATCH 2/4] Add "ignore_submodules" member to "struct unpack_trees_options" Jens Lehmann
2010-04-09 21:39 ` [WIP PATCH 3/4] Teach checkout to recursively checkout submodules Jens Lehmann
2010-04-09 21:40 ` [WIP PATCH 4/4] Teach checkout-index " Jens Lehmann
2010-04-09 22:04   ` Junio C Hamano
2010-04-09 23:22     ` Jens Lehmann
2010-04-10  5:07 ` [WIP PATCH 0/4] Recursively " 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=7vd3y81e3s.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).