From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Lars Hjemli <hjemli@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] archive.c: add support for --submodules[=(all|checkedout)]
Date: Sun, 25 Jan 2009 12:57:21 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.1.00.0901251247040.14855@racer> (raw)
In-Reply-To: <1232844726-14902-3-git-send-email-hjemli@gmail.com>
Hi,
On Sun, 25 Jan 2009, Lars Hjemli wrote:
> The --submodules option uses the enhanced read_tree_recursive() to
> enable inclusion of submodules in the generated archive.
>
> When invoked with `--submodules=all` all gitlink entries will be
> traversed, and when invoked with --submodules=checkedout (the default
> option) only gitlink entries with a git repo (i.e. checked out sub-
> modules) will be traversed.
In bare repositories, this means: none.
My reasoning for "*" instead of "all" and "" instead for "checkedout" was
that you could allow "<name1>,<name2>" at some stage, where <name> would
first be interpreted as a submodule group, and if that fails, as submodule
name.
Thinking about that more, "" seems illogical, that should rather mean
"none", i.e. the same as --no-submodules. The "checkedout" could be "."
then, perhaps? As in "what we have checked out in ./, the current
directory"?
> When a gitlink has been selected for traversal, it is required that all
> objects necessary to perform this traversal are available in either the
> primary odb or through an alternate odb. To this end, git archive will
> insert the object database of the selected gitlink (when checked out)
> as an alternate odb, using the new function add_alt_odb().
> And since alternates now can be added after parsing of
> objects/info/alternates, the error message in link_alt_odb_entry() has
> been updated to not mention this file.
Could you split that part into its own patch again, please?
> @@ -91,6 +92,70 @@ static void setup_archive_check(struct git_attr_check *check)
> check[1].attr = attr_export_subst;
> }
>
> +static int include_repository(const char *path)
> +{
> + struct stat st;
> + const char *tmp;
> +
> + /* Return early if the path does not exist since it is OK to not
> + * checkout submodules.
> + */
> + if (stat(path, &st) && errno == ENOENT)
> + return 1;
> +
> + tmp = read_gitfile_gently(path);
This will leak memory, no?
> + if (tmp) {
> + path = tmp;
> + if (stat(path, &st))
> + die("Unable to stat submodule gitdir %s: %s (%d)",
> + path, strerror(errno), errno);
> + }
> +
> + if (!S_ISDIR(st.st_mode))
> + die("Submodule gitdir %s is not a directory", path);
> +
> + if (add_alt_odb(mkpath("%s/objects", path)))
> + die("submodule odb %s could not be added as an alternate",
> + path);
> +
> + return 0;
> +}
Ciao,
Dscho
next prev parent reply other threads:[~2009-01-25 11:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 0:52 [PATCH 0/2] Add submodule-support to git archive Lars Hjemli
2009-01-25 0:52 ` [PATCH 1/2] tree.c: allow read_tree_recursive() to traverse gitlink entries Lars Hjemli
2009-01-25 0:52 ` [PATCH 2/2] archive.c: add support for --submodules[=(all|checkedout)] Lars Hjemli
2009-01-25 11:57 ` Johannes Schindelin [this message]
2009-01-25 13:00 ` Lars Hjemli
2009-01-25 13:55 ` Johannes Schindelin
2009-01-25 11:43 ` [PATCH 1/2] tree.c: allow read_tree_recursive() to traverse gitlink entries Johannes Schindelin
2009-01-25 12:30 ` Lars Hjemli
2009-01-25 4:53 ` [PATCH 0/2] Add submodule-support to git archive Nanako Shiraishi
2009-01-25 8:18 ` Lars Hjemli
2009-01-25 20:35 ` Junio C Hamano
2009-01-25 23:12 ` Lars Hjemli
2009-01-25 23:25 ` Johannes Schindelin
2009-01-26 0:41 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.00.0901251247040.14855@racer \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hjemli@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).