git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: jidanni@jidanni.org, git@vger.kernel.org
Subject: Re: git-add --verbose should say when something is already indexed
Date: Mon, 29 Dec 2008 01:02:32 -0800	[thread overview]
Message-ID: <7v63l3e4lz.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20081229175258.6117@nanako3.lavabit.com> (Nanako Shiraishi's message of "Mon, 29 Dec 2008 17:52:58 +0900")

Nanako Shiraishi <nanako3@lavabit.com> writes:

> Quoting jidanni@jidanni.org:
>
>> git-add or at least git-add --verbose should say upon
>> $ git-add bla.txt
>> $ git-add bla.txt
>> bla.txt is already in the index.
>
> I do not think it should.
>
> I suspect that you misunderstand what "git add" is. It is not about adding a new path to be tracked. Rather, it is to add the current contents of the file (unless --interactive is used).
>
> You told git to add the contents of "bla.txt" to the index as path "bla.txt". I do not think there is anything more to report after it did exactly what it was told to do.

That is almost (say, 98%) true, but it is not absolutely outlandishly
unreasonable if somebody wants:

    $ git add bla.txt
    $ edit bla.txt
    $ git add bla.txt

and

    $ git add bla.txt
    $ git add bla.txt

to behave differently.  The latter is a pure no-op.

Having said that, I do not think it is worth it.  For one thing, if you
did:

    $ git add .

after making changes to a few files and created one new file in a project
with 20,000 files, command would say "Yo, bozo, you told me to add the
same contents for path X" for 19,998  times.

If the report were not negative as Jidanni suggests, but instead were
positive, i.e.

    $ git add -v frotz.txt nitfol.txt
    added new contents for frotz.txt
    added new contents for nitfol.txt
    $ edit frotz.txt
    $ git add -v frotz.txt nitfol.txt
    added new contents for frotz.txt

it might be slightly more useful, but I doubt it is that useful in
practice.

I won't reject a patch if it is cleanly done, though.

  reply	other threads:[~2008-12-29  9:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-29  6:46 git-add --verbose should say when something is already indexed jidanni
2008-12-29  8:52 ` Nanako Shiraishi
2008-12-29  9:02   ` Junio C Hamano [this message]
2008-12-29 22:55     ` jidanni

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=7v63l3e4lz.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jidanni@jidanni.org \
    --cc=nanako3@lavabit.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 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 NNTP newsgroup(s).