git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Teach git-diff{,-files} the new option `--no-index`
Date: Thu, 22 Feb 2007 12:28:51 -0800	[thread overview]
Message-ID: <7vd542dji4.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0702222051490.22628@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Thu, 22 Feb 2007 21:01:59 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> For one thing, I want to move read_cache() out of run_diff_files() and 
>> run_diff_index() to their callers, so that the caller can use a 
>> handcrafted active_cache[] that is somewhat different from what 
>> read_cache() originally read.
>
> I don't understand. Would it not be easier to "return active_nr" in 
> read_cache_from(path) _also_ when active_cache is set? Or alternatively 
> check if active_alloc is set?

I do not understand your questions.

What I am getting at is that in the current code (without your
patch), run_diff_files() is about diff between $GIT_DIR/index
and working tree.  I want to make it diff between active_cache[]
and working tree.

The caller still can use read_cache() or read_cache_from(path)
to populate active_cache[], but it is not limited to.  It can do
other index manipulations before calling run_diff_files().  For
example, it can do read_tree() to populate active_cache[] before
calling run_diff_files() and/or run_diff_index().  Or maybe it
can run multi-tree read_tree() to populate active_cache[],
internally merge them without writing the merge results out, and
then call run_diff_files() to show "here is what would happen if
you were to run a merge now", all inside active_cache[].

Of course such a caller needs to be careful not to write
active_cache[] out when it shouldn't, but that goes without
saying.  git-diff-index already mucks with active_cache[] with
full intention of not writing it out.

Please see near the tip of 'pu', around here, for much simpler
usage pattern I had in mind:

commit 910d798768989d8fe581c2afcfd501307db81b10
Author: Junio C Hamano <junkio@cox.net>

    git-status: use in-core --refresh in a read-only repository.

commit c5cc9b14a0f36d7fab66b3152f0ebcb442674bfc
Author: Junio C Hamano <junkio@cox.net>

    git-runstatus --refresh

commit b4e1e4a787d3771f617182b3344dcdd9224bd0cb
Author: Junio C Hamano <junkio@cox.net>

    run_diff_{files,index}(): update calling convention.

  reply	other threads:[~2007-02-22 20:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 18:46 [PATCH] Teach git-diff{,-files} the new option `--no-index` Johannes Schindelin
2007-02-22 10:36 ` Junio C Hamano
2007-02-22 16:25   ` Johannes Schindelin
2007-02-22 18:09     ` Junio C Hamano
2007-02-22 18:27       ` Johannes Schindelin
2007-02-22 18:54         ` [PATCH] run_diff_files(): add option to prevent --no-index Johannes Schindelin
2007-02-22 19:18         ` [PATCH] Teach git-diff{,-files} the new option `--no-index` Junio C Hamano
2007-02-22 20:01           ` Johannes Schindelin
2007-02-22 20:28             ` Junio C Hamano [this message]
2007-02-22 20:47               ` Johannes Schindelin
2007-02-22 20:50               ` [PATCH, N'TH TRY] Teach git-diff-files " Johannes Schindelin
2007-02-23 11:44                 ` Junio C Hamano
2007-02-23 16:07                   ` diff-patch: Avoid emitting double-slashes in textual patch Johannes Schindelin

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=7vd542dji4.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --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.
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).