git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brandon Williams <bmwill@google.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH] ls-files: adding support for submodules
Date: Fri, 09 Sep 2016 16:01:25 -0700	[thread overview]
Message-ID: <xmqqh99o8ypm.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1473458004-41460-1-git-send-email-bmwill@google.com> (Brandon Williams's message of "Fri, 9 Sep 2016 14:53:24 -0700")

Brandon Williams <bmwill@google.com> writes:

> Allow ls-files to recognize submodules in order to retrieve a list of
> files from a repository's submodules.  This is done by forking off a
> process to recursively call ls-files on all submodules.

While I see why "ls-files --recurse-submodules" sounds nice ("hey, I
can get list of _all_ the files here"), and I am quite happy with
the quality of implementation (not just the code but its
documentation and test) especially from a first-time contributor, I
am not quite sure what the utility of this new feature would be,
especially given that the command is a plumbing, i.e. meant to be a
useful building block for scripts.

If I get

	$ git ls-files --recurse-submodules
	Makefile
        lib/Makefile
        lib/hello.py
	main.py
	goodbye.py

out of the command, what can I do with it without knowing where the
submodule boundaries are?  It's not like I can just do

	git ls-files --recurse-submodule |
        while read path
        do
        	git update-index --add "$path"
	done

when "lib/" is a submodule.  Instead, I'd need to go to "lib/" and
then add "Makefile" and "hello.py" from there.

> diff --git a/t/t3007-ls-files-recurse-submodules.sh b/t/t3007-ls-files-recurse-submodules.sh
> new file mode 100644
> index 0000000..78deded
> --- /dev/null
> +++ b/t/t3007-ls-files-recurse-submodules.sh
> @@ -0,0 +1,103 @@
> +...
> +test_expect_success 'setup directory structure and submodules' '
> +...
> +'
> +
> +cat >expect <<EOF
> +.gitmodules
> +a
> +b/b
> +submodule/c
> +EOF

We used to do that when we didn't know better.

Please don't do things outside test_expect_* block, especially in a
new script.

  parent reply	other threads:[~2016-09-09 23:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 21:53 [RFC/PATCH] ls-files: adding support for submodules Brandon Williams
2016-09-09 22:35 ` Jeff King
2016-09-09 22:40   ` Junio C Hamano
2016-09-09 23:01 ` Junio C Hamano [this message]
2016-09-09 23:47   ` Stefan Beller
2016-09-11 22:10     ` Junio C Hamano
2016-09-12  0:51       ` Jeff King
2016-09-12  0:52         ` Jeff King
2016-09-12 16:01           ` Junio C Hamano
     [not found]             ` <CAKoko1oSEac_Nr1SkRB=dM_r3Jnew1Et2ZKj716iU3JLyHe2GQ@mail.gmail.com>
2016-09-12 17:39               ` Brandon Williams
2016-09-12  1:47       ` Junio C Hamano
2016-09-13  0:33 ` [PATCH v2] " Brandon Williams
2016-09-13  3:35   ` Brandon Williams
2016-09-13 16:31   ` Junio C Hamano
2016-09-15 20:51     ` Junio C Hamano
2016-09-15 20:51       ` [PATCH 1/2] SQUASH??? Junio C Hamano
2016-09-15 20:51       ` [PATCH 2/2] SQUASH??? Undecided Junio C Hamano
2016-09-15 21:12         ` Stefan Beller
2016-09-15 21:37           ` Brandon Williams
2016-09-15 20:57     ` [PATCH v2] ls-files: adding support for submodules Junio C Hamano
2016-09-15 20:58     ` Junio C Hamano
2016-09-15 20:58     ` 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=xmqqh99o8ypm.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=bmwill@google.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.
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).