From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: Re: [RFC] diff-cache buglet
Date: Tue, 26 Apr 2005 11:56:05 -0700 [thread overview]
Message-ID: <7vk6mpnz96.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0504261137350.18901@ppc970.osdl.org> (Linus Torvalds's message of "Tue, 26 Apr 2005 11:38:37 -0700 (PDT)")
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> On Tue, 26 Apr 2005, Junio C Hamano wrote:
>>
>> Well, I somehow thought these things are in fixed column format;
>> mode, ->, sha, stage, and filename are all seperated with either
>> ' ' or '\t'. So if I copy MN to "1 MN", presumably you would
>> see this:
>>
>> 100644 a716d58de4a570e0038f5c307bd8db34daea021f 0 MN
>> 100644 a716d58de4a570e0038f5c307bd8db34daea021f 0 1 MN
>>
>> So while I agree that // would also work, I fail to see why you
>> would even need that.
LT> Because I'd rather _not_ have the 0 in there at all for the normal case.
LT> Yes, it's there for "show-files --stages", but it's certainly _not_ there
LT> in "diff-tree" output right now.
I know. But first let's step back a bit.
Running diff-cache when you have unmerged entries in your
GIT_INDEX_FILE is fundamentally broken. You first read_cache(),
and then you read-tree into stage 1 of the named tree, and at
that point, you do not know what stage 1 means.
We should just fix "remove-merge-entries" and call that
unconditionally before the read-tree is called. Once it is
fixed, we need to think about how to show this stage
information but that should be a separate discussion.
I have attached two versions of patch. The first one is against
the original before my stupid question; the second one is
against the one if you applied my previous patch, to revert most
of its stupidity.
################################################################
--- Patch against the original before I asked that stupid question:
cd /opt/packrat/playpen/public/in-place/git/git.junio/
jit-snap -v 0
--- k/diff-cache.c
+++ l/diff-cache.c
@@ -76,7 +76,7 @@ static void remove_merge_entries(void)
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
if (!ce_stage(ce))
- break;
+ continue;
printf("%s: unmerged\n", ce->name);
while (remove_entry_at(i)) {
if (!ce_stage(active_cache[i]))
################################################################
--- Patch to revert the stupidity:
cd /opt/packrat/playpen/public/in-place/git/git.junio/
jit-snap -v 2
--- k/diff-cache.c
+++ l/diff-cache.c
@@ -1,6 +1,5 @@
#include "cache.h"
-static int leave_unmerged = 0;
static int cached_only = 0;
static int line_termination = '\n';
@@ -86,8 +85,7 @@ static void remove_merge_entries(void)
}
}
-static char *diff_cache_usage =
-"diff-cache [-r] [-z] [--cached] [--unmerged] <tree sha1>";
+static char *diff_cache_usage = "diff-cache [-r] [-z] [--cached] <tree sha1>";
int main(int argc, char **argv)
{
@@ -112,18 +110,13 @@ int main(int argc, char **argv)
cached_only = 1;
continue;
}
- if (!strcmp(arg, "--unmerged")) {
- leave_unmerged = 1;
- continue;
- }
usage(diff_cache_usage);
}
if (argc != 2 || get_sha1_hex(argv[1], tree_sha1))
usage(diff_cache_usage);
- if (!leave_unmerged)
- remove_merge_entries();
+ remove_merge_entries();
tree = read_tree_with_tree_or_commit_sha1(tree_sha1, &size, 0);
if (!tree)
next prev parent reply other threads:[~2005-04-26 18:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 16:51 [RFC] diff-cache buglet Junio C Hamano
2005-04-26 17:11 ` Linus Torvalds
2005-04-26 17:56 ` Junio C Hamano
2005-04-26 18:06 ` Linus Torvalds
2005-04-26 18:22 ` Junio C Hamano
2005-04-26 18:38 ` Linus Torvalds
2005-04-26 18:56 ` Junio C Hamano [this message]
2005-04-26 19:09 ` Linus Torvalds
2005-04-26 20:34 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vk6mpnz96.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.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