All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, debian@onerussian.com
Subject: Re: [PATCH v2 4/4] dir: do not traverse repositories with no commits
Date: Wed, 03 Apr 2019 18:25:55 -0400	[thread overview]
Message-ID: <87bm1mbua4.fsf@kyleam.com> (raw)
In-Reply-To: <xmqqef6jsedj.fsf@gitster-ct.c.googlers.com>

Junio C Hamano <gitster@pobox.com> writes:

> Kyle Meyer <kyle@kyleam.com> writes:

>> As the required update to t3700-add shows, being looser with the check
>> means that we're stricter when adding empty repositories to the index:
>>
>>   % git add repo
>>   warning: adding embedded git repository: repo
>>   hint: You've added another git repository inside your current repository.
>>   hint: [...]
>>   error: unable to index file 'repo/'
>>   fatal: adding files failed
>
> Hmph, why should we have the initial "warning" with hint?  Shouldn't
> the above result in an outright error?  Something like:
>
>     $ git add repo ;# or git add repo/
>     error: repo does not have a commit checked out
>     fatal: adding files failed
>
> because the entire purpose of "git add repo" (or "git add repo/") when
> "repo" is a repository is to register the commit that is checked out
> in that sub-repository to the index of the top-level repository, as
> part of updating (or starting) a submodule.

Right, the hint makes no sense here.  I'll look into adjusting the
output to be appropriate.

As a minor note: I believe your "git add repo/" comments above describe
what should be and not what currently is.  The trailing slash results in
adding the content from the specified repository to the current
repository rather than registering the repository as a submodule:

  $ git --version
  git version 2.21.0
  $ git init
  $ git init a
  $ git -C a commit --allow-empty -mmsg
  $ touch a/f
  $ git add a/
  $ git status -s
  A  a/f

This behavior (and fixing it) was discussed at
https://public-inbox.org/git/20180618111919.GA10085@book.hvoigt.net

  reply	other threads:[~2019-04-03 22:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 15:02 [PATCH 0/4] dir: Treat a repository without commits as a repository Kyle Meyer
2019-03-14 15:02 ` [PATCH 1/4] submodule: refuse to add repository with no commits Kyle Meyer
2019-03-16 15:40   ` Kyle Meyer
2019-04-02 18:35     ` [PATCH v2 0/4] dir: Treat a repository without commits as a repository Kyle Meyer
2019-04-02 18:35       ` [PATCH v2 1/4] submodule: refuse to add repository with no commits Kyle Meyer
2019-04-04  7:24         ` Junio C Hamano
2019-04-02 18:35       ` [PATCH v2 2/4] t3000: move non-submodule repo test to separate file Kyle Meyer
2019-04-03  7:59         ` Junio C Hamano
2019-04-03 22:21           ` Kyle Meyer
2019-04-02 18:35       ` [PATCH v2 3/4] t3009: test that ls-files -o traverses bogus repo Kyle Meyer
2019-04-02 18:35       ` [PATCH v2 4/4] dir: do not traverse repositories with no commits Kyle Meyer
2019-04-03  8:05         ` Junio C Hamano
2019-04-03 22:25           ` Kyle Meyer [this message]
2019-03-14 15:02 ` [PATCH 2/4] t3000: move non-submodule repo test to separate file Kyle Meyer
2019-03-14 15:02 ` [PATCH 3/4] t3009: test that ls-files -o traverses bogus repo Kyle Meyer
2019-03-14 15:02 ` [PATCH 4/4] dir: do not traverse repositories with no commits Kyle Meyer

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=87bm1mbua4.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=debian@onerussian.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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.