Skip to content

Instantly share code, notes, and snippets.

@hexmode
Created July 12, 2015 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hexmode/257d227474c98d03df4f to your computer and use it in GitHub Desktop.
Save hexmode/257d227474c98d03df4f to your computer and use it in GitHub Desktop.
From: "Mark A. Hershberger" <mah@nichework.com>
To: support@github.com
Subject: diff on github.com doesn't match "git diff"
Organization: NicheWork LLC
For the repository at https://github.com/hexmode/mediawiki-el, my
current checkout shows:
$ git log --oneline -3
47875f7 Bump to 2.2.6
2f9d7e7 Fix page-get-revision (confusing rev and revision variables
9dbbbd6 more rendering issues
git diff shows:
$ git diff HEAD~2 HEAD~1
diff --git a/mediawiki.el b/mediawiki.el
index d9c8136..9afc61c 100755
--- a/mediawiki.el
+++ b/mediawiki.el
@@ -10,7 +10,7 @@
;; Created: Sep 17 2004
;; Keywords: mediawiki wikipedia network wiki
;; URL: http://github.com/hexmode/mediawiki-el
-;; Last Modified: <2015-04-03 18:08:35 mah>
+;; Last Modified: <2015-07-11 19:42:48 mah>
(defconst mediawiki-version "2.2.5"
"Current version of mediawiki.el.")
@@ -1166,10 +1166,10 @@ return the whole revision structure."
(let ((rev (cdr (nth revision (cddr (assq 'revisions (cddr page)))))))
(cond
((eq bit 'content)
- (cadr revision))
- ((assoc bit (car revision))
- (cdr (assoc bit (car revision))))
- (t revision))))
+ (cadr rev))
+ ((assoc bit (car rev))
+ (cdr (assoc bit (car rev))))
+ (t rev))))
(defun mediawiki-pagelist-find-page (pagelist title)
"Given PAGELIST, extract the informaton for TITLE."
$
However, github, at
https://github.com/hexmode/mediawiki-el/commit/2f9d7e7fa9838ff2e167f281a36f7af6cdbab0db
shows:
@@ -10,7 +10,7 @@
;; Created: Sep 17 2004
;; Keywords: mediawiki wikipedia network wiki
;; URL: http://github.com/hexmode/mediawiki-el
-;; Last Modified: <2015-04-03 18:08:35 mah>
+;; Last Modified: <2015-07-11 19:42:48 mah>
(defconst mediawiki-version "2.2.5"
"Current version of mediawiki.el.")
@@ -1166,10 +1166,10 @@ return the whole revision structure."
"Given a PAGE from a pagelist structure, extract the title."
(cdr (assq 'title (cadr page))))
-(defun mediawiki-page-get-revision (page revision &optional bit)
- "Given a PAGE, extract a REVISION from the pagelist structure.
-If BIT is 'content, then return the content only. Otherwise,
-return only the items that BIT matches. If BIT isn't given,
+(defun mediawiki-page-get-revision (page revision &optional bit)
+ "Given a PAGE, extract a REVISION from the pagelist structure.
+If BIT is 'content, then return the content only. Otherwise,
+return only the items that BIT matches. If BIT isn't given,
return the whole revision structure."
(let ((rev (cdr (nth revision (cddr (assq 'revisions (cddr page)))))))
(cond
The difference is apparently because github sees the following bit:
(if (string= "GET / HTTP/1.0^M\nMIME-Version: 1.0^M\nConnection: close^M\nHost: example.com^M\nAccept: */*^M\nUser-Agent: URL/Emacs^M\nContent-length: 4^M\n^M\ntest"
(where the ^M's are control characters) and re-interprets it as
(if (string= "GET / HTTP/1.0
\nMIME-Version: 1.0
\nConnection: close
\nHost: example.com
\nAccept: */*
\nUser-Agent: URL/Emacs
\nContent-length: 4
\n
\ntest"
It should avoid that sort of reinterpretation in the middle of a file
that is not CR-LF terminated.
--
Mark A. Hershberger
NicheWork LLC
717-271-1084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment