* How to use .gitattributes to tell git that .ini is text file?
@ 2011-08-20 2:06 jelly
2011-08-20 9:59 ` Chris Packham
0 siblings, 1 reply; 2+ messages in thread
From: jelly @ 2011-08-20 2:06 UTC (permalink / raw)
To: Git讨论组(无须订阅)
When I use like this, it takes no effect.
C:\Users\jelly\Documents\My Knowledge\Plugins>cat .gitattributes*.ini text
C:\Users\jelly\Documents\My Knowledge\Plugins>git diffdiff --git a/Misc/plugin.ini b/Misc/plugin.iniindex 078c8a9..f73153c 100755Binary files a/Misc/plugin.ini and b/Misc/plugin.ini differ
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to use .gitattributes to tell git that .ini is text file?
2011-08-20 2:06 How to use .gitattributes to tell git that .ini is text file? jelly
@ 2011-08-20 9:59 ` Chris Packham
0 siblings, 0 replies; 2+ messages in thread
From: Chris Packham @ 2011-08-20 9:59 UTC (permalink / raw)
To: jelly
Cc: "Git讨论组(无须订阅)"
On 20/08/11 14:06, jelly wrote:
> When I use like this, it takes no effect.
> C:\Users\jelly\Documents\My Knowledge\Plugins>cat .gitattributes*.ini text
> C:\Users\jelly\Documents\My Knowledge\Plugins>git diffdiff --git a/Misc/plugin.ini b/Misc/plugin.iniindex 078c8a9..f73153c 100755Binary files a/Misc/plugin.ini and b/Misc/plugin.ini differ
I think you might be running into some problems with the end of line
detection. What git version are you running? I think what you want in
.gitattributes is '*.ini diff' (see below)
I did some quick tests with 1.7.5 and I seem to get sane behaviour
without needing .gitattributes
printf '\r\nfoo\r\n' > foo.ini
git commit -m"" foo.ini
# change content
printf '\r\nbar\r\n' > foo.ini
git diff
diff --git a/foo.ini b/foo.ini
index 35c61a9..b2b98e6 100644
--- a/foo.ini
+++ b/foo.ini
@@ -1,2 +1,2 @@
-foo
+bar
# insert non-printable character
printf '\nbar\0\n' > foo.ini
git diff
diff --git a/foo.ini b/foo.ini
index 35c61a9..aff5caf 100644
Binary files a/foo.ini and b/foo.ini differ
Even with the binary content I can tell git diff to treat the files as
text (not that you can see it in the email but with less as my pager I
actually get an indication that there is a funny character there)
git diff -a
diff --git a/foo.ini b/foo.ini
index 35c61a9..aff5caf 100644
--- a/foo.ini
+++ b/foo.ini
@@ -1,2 +1,2 @@
-
-foo
+
+bar
If you want to tell git diff to always use the -a option for .ini files
try this
echo '*.ini diff' > .gitattributes
git diff
diff --git a/foo.ini b/foo.ini
index 35c61a9..aff5caf 100644
--- a/foo.ini
+++ b/foo.ini
@@ -1,2 +1,2 @@
-
-foo
+
+bar
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-20 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-20 2:06 How to use .gitattributes to tell git that .ini is text file? jelly
2011-08-20 9:59 ` Chris Packham
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).