All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] archive: learn to include submodules in output archive
@ 2017-03-12  7:54 Nikhil Benesch
  2017-03-12  7:54 ` [PATCH 1/1] " Nikhil Benesch
  0 siblings, 1 reply; 6+ messages in thread
From: Nikhil Benesch @ 2017-03-12  7:54 UTC (permalink / raw)
  To: git; +Cc: Lars Hjemli, Nikhil Benesch

Reviving an old patch from Lars Hjemli to teach `git archive` to
`--recurse-submodules`, which is, in my opinion, a sorely needed feature. I'm
afraid this is the first patch I've submitted for review, so I wasn't sure who
to CC. Apologies if I've gotten the wrong folks.

Nikhil Benesch (1):
  archive: learn to include submodules in output archive

 Documentation/git-archive.txt |   8 ++-
 archive.c                     |  22 +++++----
 archive.h                     |   1 +
 submodule.c                   |   2 +-
 submodule.h                   |   1 +
 t/t5005-archive-submodules.sh | 112 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+), 13 deletions(-)
 create mode 100755 t/t5005-archive-submodules.sh

-- 
2.12.0.244.g625568cd8.dirty


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] archive: learn to include submodules in output archive
  2017-03-12  7:54 [PATCH 0/1] archive: learn to include submodules in output archive Nikhil Benesch
@ 2017-03-12  7:54 ` Nikhil Benesch
  2017-03-13  0:36   ` Junio C Hamano
  2017-03-13 22:12   ` Stefan Beller
  0 siblings, 2 replies; 6+ messages in thread
From: Nikhil Benesch @ 2017-03-12  7:54 UTC (permalink / raw)
  To: git; +Cc: Lars Hjemli, Nikhil Benesch

This commit is a revival of Lars Hjemli's 2009 patch to provide an
option to include submodules in the output of `git archive`.

The `--recurse-submodules` option (named consistently with fetch, clone,
and ls-files) will recursively traverse submodules in the repository and
consider their contents for inclusion in the output archive, subject to
any pathspec filters. Like other commands that have learned
`--recurse-submodules`, submodules that have not been checked out will
not be traversed.

Signed-off-by: Nikhil Benesch <nikhil.benesch@gmail.com>
---
 Documentation/git-archive.txt |   8 ++-
 archive.c                     |  22 +++++----
 archive.h                     |   1 +
 submodule.c                   |   2 +-
 submodule.h                   |   1 +
 t/t5005-archive-submodules.sh | 112 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+), 13 deletions(-)
 create mode 100755 t/t5005-archive-submodules.sh

diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index cfa1e4ebe..f223f9e05 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -11,8 +11,8 @@ SYNOPSIS
 [verse]
 'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
 	      [-o <file> | --output=<file>] [--worktree-attributes]
-	      [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
-	      [<path>...]
+	      [--recurse-submodules] [--remote=<repo> [--exec=<git-upload-archive>]]
+	      <tree-ish> [<path>...]
 
 DESCRIPTION
 -----------
@@ -59,6 +59,10 @@ OPTIONS
 	Look for attributes in .gitattributes files in the working tree
 	as well (see <<ATTRIBUTES>>).
 
+--recurse-submodules::
+	Recursively include the contents of any checked-out submodules in
+	the archive.
+
 <extra>::
 	This can be any options that the archiver backend understands.
 	See next section.
diff --git a/archive.c b/archive.c
index 60b889198..8d060bad3 100644
--- a/archive.c
+++ b/archive.c
@@ -7,6 +7,7 @@
 #include "parse-options.h"
 #include "unpack-trees.h"
 #include "dir.h"
+#include "submodule.h"
 
 static char const * const archive_usage[] = {
 	N_("git archive [<options>] <tree-ish> [<path>...]"),
@@ -132,18 +133,15 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,
 		args->convert = ATTR_TRUE(check->items[1].value);
 	}
 
-	if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
-		if (args->verbose)
-			fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
-		err = write_entry(args, sha1, path.buf, path.len, mode);
-		if (err)
-			return err;
-		return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
-	}
-
 	if (args->verbose)
 		fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
-	return write_entry(args, sha1, path.buf, path.len, mode);
+	err = write_entry(args, sha1, path.buf, path.len, mode);
+	if (err)
+		return err;
+	if (S_ISDIR(mode) || (S_ISGITLINK(mode) && args->recurse_submodules &&
+			      !add_submodule_odb(path_without_prefix)))
+		return READ_TREE_RECURSIVE;
+	return 0;
 }
 
 static int write_archive_entry_buf(const unsigned char *sha1, struct strbuf *base,
@@ -411,6 +409,7 @@ static int parse_archive_args(int argc, const char **argv,
 	int verbose = 0;
 	int i;
 	int list = 0;
+	int recurse_submodules = 0;
 	int worktree_attributes = 0;
 	struct option opts[] = {
 		OPT_GROUP(""),
@@ -419,6 +418,8 @@ static int parse_archive_args(int argc, const char **argv,
 			N_("prepend prefix to each pathname in the archive")),
 		OPT_STRING('o', "output", &output, N_("file"),
 			N_("write the archive to this file")),
+		OPT_BOOL(0, "recurse-submodules", &recurse_submodules,
+			N_("recurse through submodules")),
 		OPT_BOOL(0, "worktree-attributes", &worktree_attributes,
 			N_("read .gitattributes in working directory")),
 		OPT__VERBOSE(&verbose, N_("report archived files on stderr")),
@@ -484,6 +485,7 @@ static int parse_archive_args(int argc, const char **argv,
 		}
 	}
 	args->verbose = verbose;
+	args->recurse_submodules = recurse_submodules;
 	args->base = base;
 	args->baselen = strlen(base);
 	args->worktree_attributes = worktree_attributes;
diff --git a/archive.h b/archive.h
index 415e0152e..96e217ac5 100644
--- a/archive.h
+++ b/archive.h
@@ -12,6 +12,7 @@ struct archiver_args {
 	time_t time;
 	struct pathspec pathspec;
 	unsigned int verbose : 1;
+	unsigned int recurse_submodules : 1;
 	unsigned int worktree_attributes : 1;
 	unsigned int convert : 1;
 	int compression_level;
diff --git a/submodule.c b/submodule.c
index 3b98766a6..5fe5a3a8e 100644
--- a/submodule.c
+++ b/submodule.c
@@ -121,7 +121,7 @@ void stage_updated_gitmodules(void)
 		die(_("staging updated .gitmodules failed"));
 }
 
-static int add_submodule_odb(const char *path)
+int add_submodule_odb(const char *path)
 {
 	struct strbuf objects_directory = STRBUF_INIT;
 	int ret = 0;
diff --git a/submodule.h b/submodule.h
index 05ab674f0..d59fd2537 100644
--- a/submodule.h
+++ b/submodule.h
@@ -35,6 +35,7 @@ extern int is_staging_gitmodules_ok(void);
 extern int update_path_in_gitmodules(const char *oldpath, const char *newpath);
 extern int remove_path_from_gitmodules(const char *path);
 extern void stage_updated_gitmodules(void);
+extern int add_submodule_odb(const char *path);
 extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
 		const char *path);
 extern int submodule_config(const char *var, const char *value, void *cb);
diff --git a/t/t5005-archive-submodules.sh b/t/t5005-archive-submodules.sh
new file mode 100755
index 000000000..747e38627
--- /dev/null
+++ b/t/t5005-archive-submodules.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+test_description='git archive can include submodule content'
+
+. ./test-lib.sh
+
+add_file()
+{
+	git add $1 &&
+	git commit -m "added $1"
+}
+
+add_submodule()
+{
+	mkdir $1 && (
+		cd $1 &&
+		git init &&
+		echo "File $2" >$2 &&
+		add_file $2
+	) &&
+	add_file $1
+}
+
+test_expect_success 'by default, submodules are not included' '
+	echo "File 1" >1 &&
+	add_file 1 &&
+	add_submodule 2 3 &&
+	add_submodule 4 5 &&
+	cat <<EOF >expected &&
+1
+2/
+4/
+EOF
+	git archive HEAD >normal.tar &&
+	tar -tf normal.tar >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'with --recurse-submodules, checked out submodules are included' '
+	cat <<EOF >expected &&
+1
+2/
+2/3
+4/
+4/5
+EOF
+	git archive --recurse-submodules HEAD >full.tar &&
+	tar -tf full.tar >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'submodules in submodules are supported' '
+	(cd 4 && add_submodule 6 7) &&
+	add_file 4 &&
+	cat <<EOF >expected &&
+1
+2/
+2/3
+4/
+4/5
+4/6/
+4/6/7
+EOF
+	git archive --recurse-submodules HEAD >recursive.tar &&
+	tar -tf recursive.tar >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'packed submodules are supported' '
+	msg=$(cd 2 && git repack -ad && git count-objects) &&
+	test "$msg" = "0 objects, 0 kilobytes" &&
+	git archive --recurse-submodules HEAD >packed.tar &&
+	tar -tf packed.tar >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'pathspecs supported' '
+	cat <<EOF >expected &&
+2/3
+4/6/7
+EOF
+	git archive --recurse-submodules HEAD >recursive.tar &&
+	tar -tf recursive.tar 4/6/7 2/3 >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'missing submodule packs triggers an error' '
+	mv 2/.git/objects/pack .git/packdir2 &&
+	test_must_fail git archive --recurse-submodules HEAD
+'
+
+test_expect_success '--recurse-submodules skips non-checked out submodules' '
+	cat <<EOF >expected &&
+1
+2/
+4/
+4/5
+4/6/
+4/6/7
+EOF
+	rm -rf 2/.git &&
+	git archive --recurse-submodules HEAD >partial.tar &&
+	tar -tf partial.tar >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'missing objects in a submodule triggers an error' '
+	find 4/.git/objects -type f | xargs rm &&
+	test_must_fail git archive --recurse-submodules HEAD
+'
+
+test_done
-- 
2.12.0.244.g625568cd8.dirty


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] archive: learn to include submodules in output archive
  2017-03-12  7:54 ` [PATCH 1/1] " Nikhil Benesch
@ 2017-03-13  0:36   ` Junio C Hamano
  2017-03-13 22:12   ` Stefan Beller
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2017-03-13  0:36 UTC (permalink / raw)
  To: Nikhil Benesch; +Cc: git, Lars Hjemli

Nikhil Benesch <nikhil.benesch@gmail.com> writes:

> This commit is a revival of Lars Hjemli's 2009 patch to provide an
> option to include submodules in the output of `git archive`.
>
> The `--recurse-submodules` option (named consistently with fetch, clone,
> and ls-files) will recursively traverse submodules in the repository and
> consider their contents for inclusion in the output archive, subject to
> any pathspec filters. Like other commands that have learned
> `--recurse-submodules`, submodules that have not been checked out will
> not be traversed.
>
> Signed-off-by: Nikhil Benesch <nikhil.benesch@gmail.com>
> ---

I'll let others comment on the proposed log message.

> diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
> index cfa1e4ebe..f223f9e05 100644
> --- a/Documentation/git-archive.txt
> +++ b/Documentation/git-archive.txt
> @@ -11,8 +11,8 @@ SYNOPSIS
>  [verse]
>  'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
>  	      [-o <file> | --output=<file>] [--worktree-attributes]
> -	      [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
> -	      [<path>...]
> +	      [--recurse-submodules] [--remote=<repo> [--exec=<git-upload-archive>]]
> +	      <tree-ish> [<path>...]

With the reflowing of lines it was not immediately obvious, but the
only change is to addd [--recurse-submodules] in front of the
existing [--remote=<repo>] option.  It would have probably made more
sense to add new things at the end, just because these options can
be given in any order.

> +--recurse-submodules::
> +	Recursively include the contents of any checked-out submodules in
> +	the archive.

OK.  

A question to the submodule folks: Is "checked-out" the right terminology
in this context?  I am wondering if we have reached more official set
of words to express submodule states discussed in [*1*].

> -	if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
> -		if (args->verbose)
> -			fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
> -		err = write_entry(args, sha1, path.buf, path.len, mode);
> -		if (err)
> -			return err;
> -		return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
> -	}
> -
>  	if (args->verbose)
>  		fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
> -	return write_entry(args, sha1, path.buf, path.len, mode);
> +	err = write_entry(args, sha1, path.buf, path.len, mode);
> +	if (err)
> +		return err;
> +	if (S_ISDIR(mode) || (S_ISGITLINK(mode) && args->recurse_submodules &&
> +			      !add_submodule_odb(path_without_prefix)))
> +		return READ_TREE_RECURSIVE;
> +	return 0;

So, we used to (and without the option we still) stop recursing when
we see a gitlink after asking write_entry() to write the path itself
out, but with the option, we keep going.

How does pathspec limiting work with this codepath?  If you have a
superproject with a regular file "sub/README" that belongs to the
superproject itself, and a submodule at "sub/module/", what makes
sure that this command

    $ git archive --recurse-submodules HEAD -- 'sub/R*' 'sub/module/lib/'

looks only in 'lib/' part of the submodule?

> diff --git a/t/t5005-archive-submodules.sh b/t/t5005-archive-submodules.sh
> new file mode 100755
> index 000000000..747e38627
> --- /dev/null
> +++ b/t/t5005-archive-submodules.sh
> @@ -0,0 +1,112 @@
> +#!/bin/sh
> +
> +test_description='git archive can include submodule content'
> +
> +. ./test-lib.sh
> +
> +add_file()
> +{

Style.  A shell function begins like so (see Documentation/CodingGuidelines):

	add_file () {

> +	git add $1 &&

Put dq around "$1" to make it easier to reuse, even if you know you
only happen to use pathnames without any $IFS whitespace characters.

I think all of these comments apply to the other shell function you
added to this file..

> +test_expect_success 'by default, submodules are not included' '
> +	echo "File 1" >1 &&
> +	add_file 1 &&
> +	add_submodule 2 3 &&
> +	add_submodule 4 5 &&
> +	cat <<EOF >expected &&
> +1
> +2/
> +4/
> +EOF

Use <<-EOF to allow you to indent your here-doc data.  Also when
your here-doc data does not need any $variable_interpolation, quote
the end marker to help reduce reviewer's mental burden, i.e.

	cat <<-\EOF >expected &&
	1
	2/
	4/
	EOF

The same comment applies to other tests (I won't even repeat this).

> +	git archive HEAD >normal.tar &&
> +	tar -tf normal.tar >actual &&

Lose "-" from "-tf"; that's the canonical and the most portable way
to spell the option to "tar".

> +test_expect_success 'packed submodules are supported' '
> +	msg=$(cd 2 && git repack -ad && git count-objects) &&
> +	test "$msg" = "0 objects, 0 kilobytes" &&
> +	git archive --recurse-submodules HEAD >packed.tar &&
> +	tar -tf packed.tar >actual &&
> +	test_cmp expected actual
> +'

I am not sure how packing would be expected to break anything, but
an extra test may not hurt.

I notice that you only test the case where the submodule's ".git" 
is embedded in its working tree (as opposed to ".git" being a
"gitdir:" file that points at the real location of the repository,
somewhere inside ".git/modules/" of the superproject).  You probably
want to make sure that also works, too.

I also notice that you do not use any pathspec in your "git archive"
invocation.  You'd want to make sure that works as expected.

Thanks.


[Reference]

*1* <20170209020855.23486-1-sbeller@google.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] archive: learn to include submodules in output archive
  2017-03-12  7:54 ` [PATCH 1/1] " Nikhil Benesch
  2017-03-13  0:36   ` Junio C Hamano
@ 2017-03-13 22:12   ` Stefan Beller
  2017-03-13 22:57     ` Stefan Beller
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Beller @ 2017-03-13 22:12 UTC (permalink / raw)
  To: Nikhil Benesch; +Cc: git, Lars Hjemli

Welcome to the Git community!

On Sat, Mar 11, 2017 at 11:54 PM, Nikhil Benesch
<nikhil.benesch@gmail.com> wrote:
> This commit is a revival of Lars Hjemli's 2009 patch to provide an
> option to include submodules in the output of `git archive`.

I am unaware of said patch, could you link to it, e.g.
on https://public-inbox.org/git/ ?

>
> The `--recurse-submodules` option (named consistently with fetch, clone,
> and ls-files)

... and unlike fetch and push we do not need to introduce extra options?
(or they can be added later when the need arises)

> will recursively traverse submodules in the repository and
> consider their contents for inclusion in the output archive, subject to
> any pathspec filters.

ok.

> Like other commands that have learned
> `--recurse-submodules`, submodules that have not been checked out will
> not be traversed.

Junio writes:
> A question to the submodule folks: Is "checked-out" the right terminology
> in this context?  I am wondering if we have reached more official set
> of words to express submodule states discussed in [*1*].

http://public-inbox.org/git/20170209020855.23486-1-sbeller@google.com/

The "checked-out" here would translate to "populated" in said proposal.

I guess that is sufficient for the first implementation, but eventually we
might be interested in "recurse-submodules=active/init" as well.
Consider the case, where you delete a submodule and commit it.
Then you still want to be able to create an archive for HEAD^ (with
submodules). So in that case we'd want to recurse into any submodule
that has a git directory with the commit as recorded by the superproject,
i.e. the example given would refer to "depopulated" in the referenced
proposal.

When the initialization is missing, we may not be interested in that
submodule any more, but we don't know for the user, so a user may
want to ask for "archive --recurse-submodules={all / initialized-only /
all-submoduless-with-git-dir, none, working-tree}". No need to add all
these options in the first patch, but keep that in mind for future
extensions.

> @@ -59,6 +59,10 @@ OPTIONS
>         Look for attributes in .gitattributes files in the working tree
>         as well (see <<ATTRIBUTES>>).
>
> +--recurse-submodules::
> +       Recursively include the contents of any checked-out submodules in
> +       the archive.
> +

Here is "any", in the commit message we had "subject to any pathspec filters."

> @@ -132,18 +133,15 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,
>                 args->convert = ATTR_TRUE(check->items[1].value);
>         }
>
> -       if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
> -               if (args->verbose)
> -                       fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
> -               err = write_entry(args, sha1, path.buf, path.len, mode);
> -               if (err)
> -                       return err;
> -               return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
> -       }
> -
>         if (args->verbose)
>                 fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
> -       return write_entry(args, sha1, path.buf, path.len, mode);
> +       err = write_entry(args, sha1, path.buf, path.len, mode);
> +       if (err)
> +               return err;
> +       if (S_ISDIR(mode) || (S_ISGITLINK(mode) && args->recurse_submodules &&
> +                             !add_submodule_odb(path_without_prefix)))

This is a bit hard to read. Maybe reformatting can help

     if (S_ISDIR(mode) ||
        (S_ISGITLINK(mode) &&
         args->recurse_submodules &&
         !add_submodule_odb(path_without_prefix)))
        return ...

Though I wonder if we need to special case the
return value of add_submodule_odb as that could
be an error instead of fall through "return 0;" ?

> @@ -419,6 +418,8 @@ static int parse_archive_args(int argc, const char **argv,
>                         N_("prepend prefix to each pathname in the archive")),
>                 OPT_STRING('o', "output", &output, N_("file"),
>                         N_("write the archive to this file")),
> +               OPT_BOOL(0, "recurse-submodules", &recurse_submodules,
> +                       N_("recurse through submodules")),

This is the first time hearing "through" used with submodules.
I guess it makes sense when looking at the contents on disk as
a tree data structure.

push:    N_("control recursive pushing of submodules"),
fetch:    N_("control recursive fetching of submodules"),
grep:    N_("recursivley search in each submodule")),
ls-files:    N_("recurse through submodules")),

Ok, we introduced recursing "through" submodules with ls-files.

...
> +
> +add_submodule()
> +{
> +       mkdir $1 && (
> +               cd $1 &&
> +               git init &&
> +               echo "File $2" >$2 &&
> +               add_file $2

test_create_repo / test_commit
might come in handy here as well.

> +       ) &&
> +       add_file $1
> +}
> +
> +test_expect_success 'by default, submodules are not included' '

This test case may be covered elsewhere (in the default archive tests)
already, though not spelled out as such?

> +test_expect_success 'with --recurse-submodules, checked out submodules are included' '
> +       cat <<EOF >expected &&

In the modern parts of Git we indent the content of the here-doc-text
(If the operator is “<<-” instead of “<<”, then leading tabs in the
here-doc-text are stripped.)
i.e. cat <<-\EOF >expect
    well indented text
    that doesn't break visual alignment
    of tests.
    EOF
    git archive ...

There are a lot of old tests still out there, so it is easy to
find them for guidance first. :/


> +test_expect_success 'submodules in submodules are supported' '

cool! Usually these are referred to as "nested submodules" in
case you want to shorten the description.

> +test_expect_success 'packed submodules are supported' '

Not sure what we try to test here? The internal representation
of the submodule ought to not matter.

> +       msg=$(cd 2 && git repack -ad && git count-objects) &&
> +       test "$msg" = "0 objects, 0 kilobytes" &&

I read that in submodule tests before; t7408 that tests if
submodules with alternates are useful. I am not convinced we
need this test here?

> +test_expect_success 'pathspecs supported' '
..
> +       git archive --recurse-submodules HEAD >recursive.tar &&

The test ought to test that Git can use pathspecs ...

> +       tar -tf recursive.tar 4/6/7 2/3 >actual &&

... unlike tar. We consider all external tools to be perfect within
the git test suite. So we rather want to test for the absence of
paths, that were not given as a pathspec to the git archive command.

> +test_expect_success 'missing submodule packs triggers an error' '

cool!

> +       mv 2/.git/objects/pack .git/packdir2 &&

Uh :/ please do not assume we have the submodule at
<path>/.git. See 293ab15ee (submodule: teach rm to remove
submodules unless they contain a git directory, 2012) for example.

> +       test_must_fail git archive --recurse-submodules HEAD

Do we want to also check for a sensible error message here?
e.g.
    test_must_fail git archive ... >out &&
    test_i18n_grep "<message>" out

> +test_expect_success '--recurse-submodules skips non-checked out submodules' '

I read that as "skips unpopulated" ...


Thanks,
Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] archive: learn to include submodules in output archive
  2017-03-13 22:12   ` Stefan Beller
@ 2017-03-13 22:57     ` Stefan Beller
  2017-03-13 23:18       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Beller @ 2017-03-13 22:57 UTC (permalink / raw)
  To: Nikhil Benesch; +Cc: git, Lars Hjemli

On Mon, Mar 13, 2017 at 3:12 PM, Stefan Beller <sbeller@google.com> wrote:

>> will recursively traverse submodules in the repository and
>> consider their contents for inclusion in the output archive, subject to
>> any pathspec filters.

git-archive pays attention to export-ignore and export-subst attribute
as read from .gitattributes or $GIT_DIR/info/attributes

When recursing into submodules, we'd need to clarify if the attributes
from the superproject or from the submodules are applied; or both.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] archive: learn to include submodules in output archive
  2017-03-13 22:57     ` Stefan Beller
@ 2017-03-13 23:18       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2017-03-13 23:18 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Nikhil Benesch, git, Lars Hjemli

Stefan Beller <sbeller@google.com> writes:

> On Mon, Mar 13, 2017 at 3:12 PM, Stefan Beller <sbeller@google.com> wrote:
>
>>> will recursively traverse submodules in the repository and
>>> consider their contents for inclusion in the output archive, subject to
>>> any pathspec filters.
>
> git-archive pays attention to export-ignore and export-subst attribute
> as read from .gitattributes or $GIT_DIR/info/attributes
>
> When recursing into submodules, we'd need to clarify if the attributes
> from the superproject or from the submodules are applied; or both.

I think the most natural expectation is for the output from the
"archive --recurse-submodules" command is to be logical
concatenation of "archive" run at the top-level and submodules,
adjusting the output from the latter with leading paths to the
submodules.  For that to happen, the attributes that apply to paths
inside a submodule must come from that submodule's setting.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-13 23:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12  7:54 [PATCH 0/1] archive: learn to include submodules in output archive Nikhil Benesch
2017-03-12  7:54 ` [PATCH 1/1] " Nikhil Benesch
2017-03-13  0:36   ` Junio C Hamano
2017-03-13 22:12   ` Stefan Beller
2017-03-13 22:57     ` Stefan Beller
2017-03-13 23:18       ` Junio C Hamano

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.