Re: [WIP PATCH 1/4] Prepare checkout_entry() for recursive checkout of submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jens Lehmann <Jens.Lehmann@xxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]