From: Dmitry Potapov <dpotapov@gmail.com>
To: Steffen Prohaska <prohaska@zib.de>
Cc: gitster@pobox.com, torvalds@linux-foundation.org,
git@vger.kernel.org, Dmitry Potapov <dpotapov@gmail.com>
Subject: [PATCH] Don't display crlf warning twice
Date: Mon, 14 Jan 2008 02:46:19 +0300 [thread overview]
Message-ID: <1200267979-17683-1-git-send-email-dpotapov@gmail.com> (raw)
In-Reply-To: <1200241847776-git-send-email-prohaska@zib.de>
'git add' could call crlf_to_git() twice, and this caused that the same
crlf warning being display twice. The first time crlf_to_git() is called
when a file is added to index, and it could be called the second time
during writing the index.
This patches sets safe_crlf to false before the second call.
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
On Sun, Jan 13, 2008 at 05:30:47PM +0100, Steffen Prohaska wrote:
>_
> I mentioned earlier that crlf_to_git() would be called twice. Unfortunately,
> I can't reproduce this behaviour and are not even sure if it ever happend.
I think I have found the cause. It can be seen from the following trace:
==============
#0 crlf_to_git (path=0x814b37e "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, buf=0xbfad504c, action=-1) at convert.c:89
#1 0x080e0454 in convert_to_git (path=0x814b37e "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, dst=0xbfad504c) at convert.c:578
#2 0x080b7194 in index_fd (sha1=0xbfad508c "", fd=7, st=0xbfad50d8, write_object=0, type=OBJ_BLOB, path=0x814b37e "a") at sha1_file.c:2345
#3 0x080a7dd4 in ce_compare_data (ce=0x814b340, st=0xbfad50d8) at read-cache.c:56
#4 0x080a8045 in ce_modified_check_fs (ce=0x814b340, st=0xbfad50d8) at read-cache.c:111
#5 0x080aa66d in ce_smudge_racily_clean_entry (ce=0x814b340) at read-cache.c:1121
#6 0x080aa79d in write_index (istate=0x814a3e0, newfd=6) at read-cache.c:1177
#7 0x0804c66a in cmd_add (argc=1, argv=0xbfad6408, prefix=0x0) at builtin-add.c:261
==============
#0 crlf_to_git (path=0x814b094 "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, buf=0xbfad50ec, action=-1) at convert.c:89
#1 0x080e0454 in convert_to_git (path=0x814b094 "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, dst=0xbfad50ec) at convert.c:578
#2 0x080b7194 in index_fd (sha1=0x814b368 "", fd=7, st=0xbfad5174, write_object=1, type=OBJ_BLOB, path=0x814b094 "a") at sha1_file.c:2345
#3 0x080b731f in index_path (sha1=0x814b368 "", path=0x814b094 "a", st=0xbfad5174, write_object=1) at sha1_file.c:2377
#4 0x080a8c00 in add_file_to_index (istate=0x814a3e0, path=0x814b094 "a", verbose=0) at read-cache.c:433
#5 0x0804c640 in cmd_add (argc=1, argv=0xbfad6408, prefix=0x0) at builtin-add.c:257
==============
This patch works for me but it certainly needs better testing.
builtin-add.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 5c29cc2..f113fc1 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -258,9 +258,12 @@ int cmd_add(int argc, const char **argv, const char *prefix)
finish:
if (active_cache_changed) {
+ enum safe_crlf old = safe_crlf;
+ safe_crlf = SAFE_CRLF_FALSE;
if (write_cache(newfd, active_cache, active_nr) ||
close(newfd) || commit_locked_index(&lock_file))
die("Unable to write new index file");
+ safe_crlf = old;
}
return 0;
--
1.5.3.5
next prev parent reply other threads:[~2008-01-13 23:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-13 16:30 [PATCH v3] safecrlf: Add mechanism to warn about irreversible crlf conversions Steffen Prohaska
2008-01-13 22:02 ` Dmitry Potapov
2008-01-13 22:13 ` Dmitry Potapov
2008-01-13 23:46 ` Dmitry Potapov [this message]
2008-01-14 6:17 ` [PATCH] Don't display crlf warning twice Steffen Prohaska
2008-01-14 6:40 ` Dmitry Potapov
2008-01-14 6:53 ` Steffen Prohaska
2008-01-14 23:20 ` [PATCH] safecrlf: Add flag to convert_to_git() to disable safecrlf check Steffen Prohaska
2008-01-14 23:58 ` Junio C Hamano
2008-01-15 20:52 ` Steffen Prohaska
2008-01-15 21:41 ` Steffen Prohaska
2008-01-15 23:23 ` Junio C Hamano
2008-01-15 10:26 ` Dmitry Potapov
2008-01-15 20:39 ` Steffen Prohaska
2008-01-15 23:03 ` Dmitry Potapov
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=1200267979-17683-1-git-send-email-dpotapov@gmail.com \
--to=dpotapov@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=prohaska@zib.de \
--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).