Gitpython: diff does not show changed lines

Created on 26 Aug 2011  路  2Comments  路  Source: gitpython-developers/GitPython

I have a problem with the diff capabilities of 03.2.RC1:

If I do repo.git.diff('origin/master') it prints a nice diff:
diff --git a/base_settings.py b/base_settings.py
index d6c2ddb..c572c31 100644
--- a/base_settings.py
+++ b/base_settings.py
@@ -22,7 +22,7 @@ DATABASES = {
}
}

-TIME_ZONE = 'Europe/Zurich'
+TIME_ZONE = 'America/Chicago'

 LANGUAGE_CODE = 'en'

diff --git a/generated_requirements.txt b/generated_requirements.txt
index e69de29..f77b16b 100644
--- a/generated_requirements.txt
+++ b/generated_requirements.txt
@@ -0,0 +1 @@
+cmsplugin-flickr==0.1.2
\ No newline at end of file
diff --git a/settings.py b/settings.py
index 73aa9b1..e72486a 100644
--- a/settings.py
+++ b/settings.py
@@ -1 +1,14 @@
 from base_settings import *
+FLICKR_API_KEY = "132"
+FLICKR_API_SECRET = "123"
+SECRET_KEY = "rEWcYWl8KngUNSaELWKDqm2RGod3CYlEHmNCf5rwPj2D52BBYIYKcJt7yAPuJh0R"
+LANGUAGES = [
+    ("en", "English"),
+    ("de", "German")
+]
+SIMPLE_SSO_SECRET = "UJ7zUNDJxzEWr8tmBLPy1T9LfhWaS7rIdcHUCUF7l5naoN42amDNy8CK6x7UNMtO"
+SIMPLE_SSO_KEY = "FBUQ21ULQsYfLGJgbchGPQc9uDozXJ73mtW4g9ob517BWOA1ZYQGG9kmjyW7zaOV"
+SIMPLE_SSO_SERVER = "http://192.168.2.69:8000/auth/"
+INSTALLED_APPS += [
+    "cmsplugin_flickr"
+]
\ No newline at end of file

If I run:

for d in repo.index.diff(repo.remotes.origin.refs.master.commit):
    print d
    print d.diff

I do not get the lines changed:

base_settings.py
=======================================================
lhs: 100644 | c572c313d74e7d2df63704e4712d782fd7e731e8
rhs: 100644 | d6c2ddbea1926853b82c43ecd21e2088735ca32f

generated_requirements.txt
=======================================================
lhs: 100644 | f77b16bda1cf332bb17baaa02abb74cac51c5374
rhs: 100644 | e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

settings.py
=======================================================
lhs: 100644 | e72486aea3e660427e9eb77310c7ab3682d277ec
rhs: 100644 | 73aa9b146ba9f7e49eb43b1f7e3d190e7baf871b

Is this a bug or am i using it wrong?

Most helpful comment

Not sure if its a bug or a "feature" - but it works if you use this command:

commit.diff(previous_commit, create_patch=True)

All 2 comments

Not sure if its a bug or a "feature" - but it works if you use this command:

commit.diff(previous_commit, create_patch=True)

The create_patch flag is expected to be provided here indeed. I hope this has fixed your issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crazyhouse33 picture crazyhouse33  路  3Comments

aaronlelevier picture aaronlelevier  路  5Comments

niso120b picture niso120b  路  4Comments

johnlinp picture johnlinp  路  6Comments

malford picture malford  路  3Comments