git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Prohaska <prohaska@zib.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] [v9] safecrlf: Add mechanism to warn about irreversible crlf conversions
Date: Wed, 6 Feb 2008 21:35:11 +0100	[thread overview]
Message-ID: <E2F063EE-06C5-4B85-8511-5FD4EB6FFEC9@zib.de> (raw)
In-Reply-To: <7vk5lhyir6.fsf@gitster.siamese.dyndns.org>


On Feb 6, 2008, at 8:42 PM, Junio C Hamano wrote:

> Steffen Prohaska <prohaska@zib.de> writes:
>
>> This repaces v9 of the patch and should be applied.
>> It contains modifications as suggested by Junio in
>> <7vbq6u32mq.fsf@gitster.siamese.dyndns.org>
>>
>>     Steffen
>>
>> -- >8 --
>
> This v9 replaces itself, ah it repaces ;-)

Yeah, I recognized this, too; but was to lazy to send another
correction ;)


>
>> git diff, git add, and any other command that calls
>> index_fd(..., write_object=1) also behave as requested by
>> safecrlf.  The user still has the chance to save her data before
>> checkout or applying the diff.
>
> "git diff" writes by calling index_fd(..., write_object=1)???
>
> I think warning in "git diff" is probably a good thing to do but
> that is not because it writes.  The warning would trigger only
> when you are comparing what you have in the work tree with
> something else, and if you get such a warning, it means what you
> can potentially commit (i.e. what you have in the work tree) is
> not "autocrlf" safe.  You would get the same warning when you
> later runn "git add" on such a file anyway, but it is nicer to
> catch the potential problem earlier.
>
> I do not know if the above "why this command should behave this
> way with respect to safecrlf" needs to be in the commit log
> message.  But I think that information should be in the
> documentation to help the end users (the end users typically do
> not have access to the commit log of git.git).
>
> The rest of the patch looked sane.  Thanks.
>
> So I'd suggest the following change to the commit log message,
> and then another patch at the end squashed into the
> Documentation/ part.
>
> If you agree with these, you can just say "Ok, amend it like
> so".  Or you can say "Here is an even better replacement."

Ok, amend it as you proposed but also squash in the following ...

-- >8 --
diff --git a/builtin-apply.c b/builtin-apply.c
index d0b3586..3b5618d 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1430,7 +1430,7 @@ static int read_old_data(struct stat *st, const  
char *path, struct strbuf *buf)
  	case S_IFREG:
  		if (strbuf_read_file(buf, path, st->st_size) != st->st_size)
  			return error("unable to open or read %s", path);
-		convert_to_git(path, buf->buf, buf->len, buf, safe_crlf);
+		convert_to_git(path, buf->buf, buf->len, buf, 0);
  		return 0;
  	default:
  		return -1;
-- >8 --

... because ...

[...]

> +
> +- "git apply" to update a text file with a patch does touch the files
> +  in the work tree, but the operation is about text files and CRLF
> +  conversion is about fixing the line ending inconsistencies, so the
> +  safety does not trigger;

... now after I read this I fully understand what you meant before.
But my v9 patch does not match your description without the change
to builtin-apply.c from above.  In v9 the mechanism was still activated
in "git apply".

	Steffen

  reply	other threads:[~2008-02-06 20:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-02 16:08 [PATCH v6] safecrlf: Add mechanism to warn about irreversible crlf conversions Steffen Prohaska
2008-02-03 10:50 ` Junio C Hamano
2008-02-03 14:36   ` Steffen Prohaska
2008-02-03 15:42     ` [PATCH v7] " Steffen Prohaska
2008-02-03 22:29       ` Johannes Schindelin
2008-02-04  4:35         ` Steffen Prohaska
2008-02-04  4:42           ` [PATCH] [v8] " Steffen Prohaska
2008-02-04 15:02             ` Johannes Schindelin
2008-02-04 16:43               ` Steffen Prohaska
2008-02-04 17:27                 ` Johannes Schindelin
2008-02-06  8:33             ` Junio C Hamano
2008-02-06 11:23               ` Steffen Prohaska
2008-02-06 11:25               ` [PATCH] [v9] " Steffen Prohaska
2008-02-06 19:42                 ` Junio C Hamano
2008-02-06 20:35                   ` Steffen Prohaska [this message]
2008-02-04 15:01           ` [PATCH v7] " Johannes Schindelin
2008-02-03 22:53     ` [PATCH v6] " 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=E2F063EE-06C5-4B85-8511-5FD4EB6FFEC9@zib.de \
    --to=prohaska@zib.de \
    --cc=Johannes.Schindelin@gmx.de \
    --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.
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).