From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Alexey Veretennikov <alexey.veretennikov@gmail.com>
Subject: Re: [elpa] master 8650a52 2/2: Issue #18: files considered different if they have different sizes
Date: Mon, 26 Dec 2016 09:40:10 -0500 [thread overview]
Message-ID: <jwvlgv2ahnk.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <20161226141927.3D0D3220088@vcs.savannah.gnu.org> (Alexey Veretennikov's message of "Mon, 26 Dec 2016 14:19:27 +0000 (UTC)")
> + (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
next parent reply other threads:[~2016-12-26 14:40 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 ` Stefan Monnier [this message]
2016-12-26 17:03 ` [elpa] master 8650a52 2/2: Issue #18: files considered different if they have different sizes Alexey Veretennikov
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=jwvlgv2ahnk.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=alexey.veretennikov@gmail.com \
--cc=emacs-devel@gnu.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.
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.