all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alexey Veretennikov <alexey.veretennikov@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] master 8650a52 2/2: Issue #18: files considered different if they have different sizes
Date: Mon, 26 Dec 2016 18:03:23 +0100	[thread overview]
Message-ID: <m24m1qaahw.fsf@Mac-34363bcb361c.lan> (raw)
In-Reply-To: <jwvlgv2ahnk.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Mon, 26 Dec 2016 09:40:10 -0500")

Thanks! I'll experiment with process-file.

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +         (diff-cmd (concat diff-command " -q" " "
>> +                           (ztree-quotify-string file1-untrampified)
>> +                           " "
>> +                           (ztree-quotify-string file2-untrampified))))
>> +    (if (and
>> +         (= (nth 7 (file-attributes file1-untrampified))
>> +            (nth 7 (file-attributes file2-untrampified)))
>> +         (> (length (shell-command-to-string diff-cmd)) 2))
>
> The function `process-file` should be able to do a better job than
> shell-command-to-string (among other things, no need for "quotify").
>
> You'll probably want to run it something like
>
>     (let* ((file1 (file-name-directory (expand-file-name file1)))
>            (file2 (file-name-directory (expand-file-name file2)))
>            (default-directory (file-name-directory file1))
>            (file1 (file-relative-name file1))
>            (file2 (file-relative-name file2))
>            (exit-code
>             (process-file diff-command nil nil nil
>                           "-q" file1 file2)))
>       (if (and (numberp exit-code) (= exit-code 0))
>           'same 'diff))
>
> BTW, a file with name
>
>    hello"; rm -rf ~/.
>
> will probably not do what you wanted.  Using process-file should fix
> this problem since it doesn't need to quote anything.  But if you insist
> on using a shell command, then just use shell-quote-argument instead of
> ztree-quotify-string.
>
>
>         Stefan

-- 
Br,
/Alexey



      reply	other threads:[~2016-12-26 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161226141926.26964.59272@vcs.savannah.gnu.org>
     [not found] ` <20161226141927.3D0D3220088@vcs.savannah.gnu.org>
2016-12-26 14:40   ` [elpa] master 8650a52 2/2: Issue #18: files considered different if they have different sizes Stefan Monnier
2016-12-26 17:03     ` Alexey Veretennikov [this message]

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=m24m1qaahw.fsf@Mac-34363bcb361c.lan \
    --to=alexey.veretennikov@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.