From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/4] diffcore_filespec: add is_binary
Date: Thu, 28 Jun 2007 23:35:59 -0700 [thread overview]
Message-ID: <11830989621033-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <7v3b0bi88r.fsf@assigned-by-dhcp.pobox.com>
diffcore-break and diffcore-rename would want to behave slightly
differently depending on the binary-ness of the data, so add one
bit to the filespec, as the structure is now passed down to
diffcore_count_changes() function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
diff.c | 16 ++++++++++++++++
diffcore.h | 1 +
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/diff.c b/diff.c
index 9938969..74c1198 100644
--- a/diff.c
+++ b/diff.c
@@ -3005,6 +3005,22 @@ void diffcore_std(struct diff_options *options)
{
if (options->quiet)
return;
+
+ /*
+ * break/rename count similarity differently depending on
+ * the binary-ness.
+ */
+ if ((options->break_opt != -1) || (options->detect_rename)) {
+ struct diff_queue_struct *q = &diff_queued_diff;
+ int i;
+
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ p->one->is_binary = file_is_binary(p->one);
+ p->two->is_binary = file_is_binary(p->two);
+ }
+ }
+
if (options->break_opt != -1)
diffcore_break(options->break_opt);
if (options->detect_rename)
diff --git a/diffcore.h b/diffcore.h
index 990dec5..0c8abb5 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -37,6 +37,7 @@ struct diff_filespec {
#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
unsigned should_free : 1; /* data should be free()'ed */
unsigned should_munmap : 1; /* data should be munmap()'ed */
+ unsigned is_binary : 1; /* data should be considered "binary" */
};
extern struct diff_filespec *alloc_filespec(const char *);
--
1.5.2.2.1414.g1e7d9
next prev parent reply other threads:[~2007-06-29 6:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <93c3eada0706280153w1898be80u7785ef2b2b1dd188@mail.gmail.com>
2007-06-29 6:07 ` Applying patches in a directory that isn't a repository Geoff Russell
2007-06-29 6:29 ` Junio C Hamano
2007-06-29 6:35 ` [PATCH 1/4] diffcore_count_changes: pass diffcore_filespec Junio C Hamano
2007-06-29 6:35 ` Junio C Hamano [this message]
2007-06-29 6:36 ` [PATCH 3/4] diffcore-delta.c: update the comment on the algorithm Junio C Hamano
2007-06-29 6:36 ` [PATCH 4/4] diffcore-delta.c: Ignore CR in CRLF for text files Junio C Hamano
2007-06-29 8:14 ` しらいしななこ
2007-06-29 8:51 ` Junio C Hamano
2007-06-30 4:18 ` Applying patches in a directory that isn't a repository Geoff Russell
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=11830989621033-git-send-email-gitster@pobox.com \
--to=gitster@pobox.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.
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).