From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Brandon Williams <bmwill@google.com>
Subject: [PATCH 05/17] convert: convert renormalize_buffer to take an index
Date: Mon, 12 Jun 2017 15:13:56 -0700 [thread overview]
Message-ID: <20170612221408.173876-6-bmwill@google.com> (raw)
In-Reply-To: <20170612221408.173876-1-bmwill@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
---
convert.c | 6 ++++--
convert.h | 3 ++-
ll-merge.c | 2 +-
merge-recursive.c | 4 ++--
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/convert.c b/convert.c
index 600d11e73..4097f521f 100644
--- a/convert.c
+++ b/convert.c
@@ -1,3 +1,4 @@
+#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "attr.h"
#include "run-command.h"
@@ -1165,14 +1166,15 @@ int convert_to_working_tree(const char *path, const char *src, size_t len, struc
return convert_to_working_tree_internal(path, src, len, dst, 0);
}
-int renormalize_buffer(const char *path, const char *src, size_t len, struct strbuf *dst)
+int renormalize_buffer(const struct index_state *istate, const char *path,
+ const char *src, size_t len, struct strbuf *dst)
{
int ret = convert_to_working_tree_internal(path, src, len, dst, 1);
if (ret) {
src = dst->buf;
len = dst->len;
}
- return ret | convert_to_git(&the_index, path, src, len, dst, SAFE_CRLF_RENORMALIZE);
+ return ret | convert_to_git(istate, path, src, len, dst, SAFE_CRLF_RENORMALIZE);
}
/*****************************************************************
diff --git a/convert.h b/convert.h
index 60cb41d6a..cecf59d1a 100644
--- a/convert.h
+++ b/convert.h
@@ -46,7 +46,8 @@ extern int convert_to_git(const struct index_state *istate,
struct strbuf *dst, enum safe_crlf checksafe);
extern int convert_to_working_tree(const char *path, const char *src,
size_t len, struct strbuf *dst);
-extern int renormalize_buffer(const char *path, const char *src, size_t len,
+extern int renormalize_buffer(const struct index_state *istate,
+ const char *path, const char *src, size_t len,
struct strbuf *dst);
static inline int would_convert_to_git(const struct index_state *istate,
const char *path)
diff --git a/ll-merge.c b/ll-merge.c
index ac0d4a5d7..d7eafb61a 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -339,7 +339,7 @@ static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr
static void normalize_file(mmfile_t *mm, const char *path)
{
struct strbuf strbuf = STRBUF_INIT;
- if (renormalize_buffer(path, mm->ptr, mm->size, &strbuf)) {
+ if (renormalize_buffer(&the_index, path, mm->ptr, mm->size, &strbuf)) {
free(mm->ptr);
mm->size = strbuf.len;
mm->ptr = strbuf_detach(&strbuf, NULL);
diff --git a/merge-recursive.c b/merge-recursive.c
index ae5238d82..eac12d488 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1639,8 +1639,8 @@ static int blob_unchanged(struct merge_options *opt,
* performed. Comparison can be skipped if both files are
* unchanged since their sha1s have already been compared.
*/
- if (renormalize_buffer(path, o.buf, o.len, &o) |
- renormalize_buffer(path, a.buf, a.len, &a))
+ if (renormalize_buffer(&the_index, path, o.buf, o.len, &o) |
+ renormalize_buffer(&the_index, path, a.buf, a.len, &a))
ret = (o.len == a.len && !memcmp(o.buf, a.buf, o.len));
error_return:
--
2.13.1.518.g3df882009-goog
next prev parent reply other threads:[~2017-06-12 22:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-12 22:13 [PATCH 00/17] convert ls-files internals to pass around an index Brandon Williams
2017-06-12 22:13 ` [PATCH 01/17] convert: convert get_cached_convert_stats_ascii to take " Brandon Williams
2017-06-12 22:13 ` [PATCH 02/17] convert: convert crlf_to_git " Brandon Williams
2017-06-12 22:13 ` [PATCH 03/17] convert: convert convert_to_git_filter_fd " Brandon Williams
2017-06-12 22:13 ` [PATCH 04/17] convert: convert convert_to_git " Brandon Williams
2017-06-12 22:13 ` Brandon Williams [this message]
2017-06-12 22:13 ` [PATCH 06/17] tree: convert read_tree to take an index parameter Brandon Williams
2017-06-12 22:13 ` [PATCH 07/17] ls-files: convert overlay_tree_on_cache to take an index Brandon Williams
2017-06-12 22:13 ` [PATCH 08/17] ls-files: convert write_eolinfo " Brandon Williams
2017-06-12 22:14 ` [PATCH 09/17] ls-files: convert show_killed_files " Brandon Williams
2017-06-12 22:14 ` [PATCH 10/17] ls-files: convert show_other_files " Brandon Williams
2017-06-12 22:14 ` [PATCH 11/17] ls-files: convert show_ru_info " Brandon Williams
2017-06-12 22:14 ` [PATCH 12/17] ls-files: convert ce_excluded " Brandon Williams
2017-06-12 22:14 ` [PATCH 13/17] ls-files: convert prune_cache " Brandon Williams
2017-06-12 22:14 ` [PATCH 14/17] ls-files: convert show_ce_entry " Brandon Williams
2017-06-12 22:14 ` [PATCH 15/17] ls-files: convert show_files " Brandon Williams
2017-06-12 22:14 ` [PATCH 16/17] ls-files: factor out debug info into a function Brandon Williams
2017-06-12 22:14 ` [PATCH 17/17] ls-files: factor out tag calculation Brandon Williams
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170612221408.173876-6-bmwill@google.com \
--to=bmwill@google.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).