From: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
To: git@vger.kernel.org
Cc: mat <matthieu.stigler@gmail.com>,
hasen j <hasan.aljudy@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Erik Faye-Lund <kusmabite@googlemail.com>,
Junio C Hamano <gitster@pobox.com>,
Avery Pennarun <apenwarr@gmail.com>,
Dmitry Potapov <dpotapov@gmail.com>,
Robert Buck <buck.robert.j@gmail.com>,
Finn Arne Gangstad <finnag@pvv.org>
Subject: [PATCH/RFC v2 3/4] Pass eol conv mode as an argument instead of using global auto_crlf
Date: Sat, 8 May 2010 23:46:20 +0200 [thread overview]
Message-ID: <de1db7b41b76dae815988590dbb707e2fa101440.1273352819.git.eyvind.bernhardsen@gmail.com> (raw)
In-Reply-To: <cover.1273352819.git.eyvind.bernhardsen@gmail.com>
This patch has no semantic changes, but makes the next commit easier to
review.
Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
---
convert.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/convert.c b/convert.c
index 4f8fcb7..2eef2f6 100644
--- a/convert.c
+++ b/convert.c
@@ -90,12 +90,13 @@ static int is_binary(unsigned long size, struct text_stat *stats)
}
static void check_safe_crlf(const char *path, int action,
- struct text_stat *stats, enum safe_crlf checksafe)
+ struct text_stat *stats, enum safe_crlf checksafe,
+ int eol_conversion)
{
if (!checksafe)
return;
- if (action == CRLF_INPUT || auto_crlf <= 0) {
+ if (action == CRLF_INPUT || eol_conversion <= 0) {
/*
* CRLFs would not be restored by checkout:
* check if we'd remove CRLFs
@@ -106,7 +107,7 @@ static void check_safe_crlf(const char *path, int action,
else /* i.e. SAFE_CRLF_FAIL */
die("CRLF would be replaced by LF in %s.", path);
}
- } else if (auto_crlf > 0) {
+ } else if (eol_conversion > 0) {
/*
* CRLFs would be added by checkout:
* check if we have "naked" LFs
@@ -121,12 +122,13 @@ static void check_safe_crlf(const char *path, int action,
}
static int crlf_to_git(const char *path, const char *src, size_t len,
- struct strbuf *buf, int action, enum safe_crlf checksafe)
+ struct strbuf *buf, int action, enum safe_crlf checksafe,
+ int eol_conversion)
{
struct text_stat stats;
char *dst;
- if ((action == CRLF_BINARY) || !auto_crlf || !len)
+ if ((action == CRLF_BINARY) || !eol_conversion || !len)
return 0;
gather_stats(src, len, &stats);
@@ -147,7 +149,7 @@ static int crlf_to_git(const char *path, const char *src, size_t len,
return 0;
}
- check_safe_crlf(path, action, &stats, checksafe);
+ check_safe_crlf(path, action, &stats, checksafe, eol_conversion);
/* Optimization: No CR? Nothing to convert, regardless. */
if (!stats.cr)
@@ -180,13 +182,13 @@ static int crlf_to_git(const char *path, const char *src, size_t len,
}
static int crlf_to_worktree(const char *path, const char *src, size_t len,
- struct strbuf *buf, int action)
+ struct strbuf *buf, int action, int eol_conversion)
{
char *to_free = NULL;
struct text_stat stats;
if ((action == CRLF_BINARY) || (action == CRLF_INPUT) ||
- auto_crlf <= 0)
+ eol_conversion <= 0)
return 0;
if (!len)
@@ -591,7 +593,7 @@ int convert_to_git(const char *path, const char *src, size_t len,
src = dst->buf;
len = dst->len;
}
- ret |= crlf_to_git(path, src, len, dst, crlf, checksafe);
+ ret |= crlf_to_git(path, src, len, dst, crlf, checksafe, auto_crlf);
if (ret) {
src = dst->buf;
len = dst->len;
@@ -621,7 +623,7 @@ int convert_to_working_tree(const char *path, const char *src, size_t len, struc
src = dst->buf;
len = dst->len;
}
- ret |= crlf_to_worktree(path, src, len, dst, crlf);
+ ret |= crlf_to_worktree(path, src, len, dst, crlf, auto_crlf);
if (ret) {
src = dst->buf;
len = dst->len;
--
1.7.1.3.gb95c9
next prev parent reply other threads:[~2010-05-08 21:46 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-08 21:46 [PATCH/RFC v2 0/4] End-of-line normalization, take 2 (now only slightly scary) Eyvind Bernhardsen
2010-05-08 21:46 ` [PATCH/RFC v2 1/4] Add "core.eolStyle" variable to control end-of-line conversion Eyvind Bernhardsen
2010-05-08 21:57 ` Linus Torvalds
2010-05-08 22:17 ` Eyvind Bernhardsen
2010-05-08 22:53 ` Eyvind Bernhardsen
2010-05-08 23:08 ` Linus Torvalds
2010-05-09 8:13 ` Eyvind Bernhardsen
2010-05-09 18:11 ` Linus Torvalds
2010-05-09 20:11 ` Eyvind Bernhardsen
2010-05-09 7:00 ` Dmitry Potapov
2010-05-09 7:30 ` hasen j
2010-05-10 7:16 ` Dmitry Potapov
2010-05-09 8:34 ` Eyvind Bernhardsen
2010-05-09 10:42 ` Eyvind Bernhardsen
2010-05-09 11:14 ` Robert Buck
2010-05-09 18:59 ` Eyvind Bernhardsen
2010-05-09 20:46 ` Robert Buck
2010-05-10 4:33 ` Eyvind Bernhardsen
2010-05-10 11:43 ` Robert Buck
2010-05-10 13:25 ` Robert Buck
2010-05-10 14:03 ` Dmitry Potapov
2010-05-09 17:02 ` Jay Soffian
2010-05-09 17:43 ` Jay Soffian
2010-05-10 18:33 ` Eyvind Bernhardsen
2010-05-09 17:45 ` Junio C Hamano
2010-05-09 18:18 ` Finn Arne Gangstad
2010-05-09 21:57 ` Junio C Hamano
2010-05-10 5:14 ` Eyvind Bernhardsen
2010-05-09 20:25 ` Eyvind Bernhardsen
2010-05-09 20:09 ` Finn Arne Gangstad
2010-05-10 8:13 ` Dmitry Potapov
2010-05-10 11:14 ` Finn Arne Gangstad
2010-05-10 13:46 ` Dmitry Potapov
2010-05-09 9:21 ` Finn Arne Gangstad
2010-05-08 21:46 ` [PATCH/RFC v2 2/4] Add tests for per-repository eol normalization Eyvind Bernhardsen
2010-05-08 21:46 ` Eyvind Bernhardsen [this message]
2010-05-08 21:46 ` [PATCH/RFC v2 4/4] Add " Eyvind Bernhardsen
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=de1db7b41b76dae815988590dbb707e2fa101440.1273352819.git.eyvind.bernhardsen@gmail.com \
--to=eyvind.bernhardsen@gmail.com \
--cc=apenwarr@gmail.com \
--cc=buck.robert.j@gmail.com \
--cc=dpotapov@gmail.com \
--cc=finnag@pvv.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hasan.aljudy@gmail.com \
--cc=kusmabite@googlemail.com \
--cc=matthieu.stigler@gmail.com \
--cc=torvalds@linux-foundation.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).