File keeping listed as changed

Developers forum for Univeral Media Server-related development (only for programmers)
Post Reply
Tiago Costa
Posts: 12
Joined: Mon Apr 28, 2014 5:35 pm

File keeping listed as changed

Post by Tiago Costa »

Hello, guys!

Since some weeks ago, I had a very recurring problem: a file constantly is being listed as modified (completely modified, in fact), no matter what I tries. I don't touch it, but even stashing, resetting, uninstalling GitHub and all repository files, etc, the file remais as modified. The file in question is CustomTabbedPaneUI.java. There is something I can do to get rid of this problem? Sometimes it delays my merges, because I can't stash/cancel it.

It appears to be a line ending problem, but I'm really not sure.

Thanks in advance!
infidel
Developer
Posts: 571
Joined: Thu Jul 12, 2012 5:37 am

Re: File keeping listed as changed

Post by infidel »

This one has annoyed me quite a bit too, I think it could be that not all committers (including me) have always had their git line endings set properly, and somehow this one got in and keeps hiding in different branches/repos and merging back in (or it could be a bug in git). It would be good if everyone
  • checks the output of

    Code: Select all

    git config --get core.autocrlf
    which should be 'true' for windows and 'input' for linux/osx, and fix it accordingly as shown here.
  • double-checks that their .git/config file doesn't override autocrlf with a different setting.
The way I make the problem go away in linux (until it pops up again :)) is to first fix the line endings in CustomTabbedPaneUI.java (to unix-style), then

Code: Select all

git add -uv
git commit -a --amend
but you have to repeat this for every affected branch.
According to github the right way to fix it is to remove the file from git and add it back in (or even do it for the whole repo :)). The line endings for CustomTabbedPaneUI.java are unix-style in the master branch, so the problem must be hiding somewhere else.

EDIT: I don't use Eclipse, but it could be the culprit.
EDIT2: It's obviously a recurring thing: cdf6224 5c3d616
Tiago Costa
Posts: 12
Joined: Mon Apr 28, 2014 5:35 pm

Re: File keeping listed as changed

Post by Tiago Costa »

Well, this is my .git/config file:

Code: Select all

[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
	hideDotFiles = dotGitOnly
[remote "origin"]
	url = https://github.com/tdcosta100/UniversalMediaServer.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[remote "upstream"]
	url = https://github.com/UniversalMediaServer/UniversalMediaServer.git
	fetch = +refs/heads/*:refs/remotes/upstream/*
[branch "ffmpeg-thumbnail-ar-fix"]
	remote = origin
	merge = refs/heads/ffmpeg-thumbnail-ar-fix
[branch "fix-ffmpeg-subtitle-convert"]
	remote = origin
	merge = refs/heads/fix-ffmpeg-subtitle-convert
[branch "H264TSAAC"]
	remote = origin
	merge = refs/heads/H264TSAAC
I think it's ok. git config -l returns me this:

Code: Select all

core.symlinks=false
core.autocrlf=true
core.editor=gitpad
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
color.ui=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=!github --credentials
filter.ghcleansmudge.clean=cat
filter.ghcleansmudge.smudge=cat
push.default=upstream
alias.dt=difftool
alias.mt=mergetool
diff.tool=vs11
difftool.prompt=false
difftool.bc4.cmd="c:/program files (x86)/beyond compare 3/bcomp.exe" "$LOCAL" "$REMOTE"
difftool.p4.cmd="c:/program files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"
difftool.vs11.cmd="c:/program files (x86)/microsoft visual studio 11.0/common7/ide/devenv.exe" '//diff' "$LOCAL" "$REMOTE"
merge.tool=bc3
mergetool.prompt=false
mergetool.keepbackup=false
mergetool.bc3.cmd="c:/program files (x86)/beyond compare 3/bcomp.exe" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
mergetool.bc3.trustexitcode=true
mergetool.p4.cmd="c:/program files/Perforce/p4merge.exe" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
mergetool.p4.trustexitcode=false
remote.origin.fetch=+refs/pull/*/head:refs/remotes/origin/pr/*
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=https://github.com/tdcosta100/UniversalMediaServer.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.upstream.url=https://github.com/UniversalMediaServer/UniversalMediaServer.git
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
branch.ffmpeg-thumbnail-ar-fix.remote=origin
branch.ffmpeg-thumbnail-ar-fix.merge=refs/heads/ffmpeg-thumbnail-ar-fix
branch.fix-ffmpeg-subtitle-convert.remote=origin
branch.fix-ffmpeg-subtitle-convert.merge=refs/heads/fix-ffmpeg-subtitle-convert
branch.H264TSAAC.remote=origin
branch.H264TSAAC.merge=refs/heads/H264TSAAC
I didn't want to commit this java file, but maybe I'll have to. Maybe I can use other Git client than GitHub for Windows. The Netbeans's Git Client does not show this problem, but I don't thinks it is reliable. Suggestions?
infidel
Developer
Posts: 571
Joined: Thu Jul 12, 2012 5:37 am

Re: File keeping listed as changed

Post by infidel »

This problem pops up with plain old git on linux so I don't think it has anything to do with GitHub for Windows, etc. If you look at the commits I linked above you'll see that others have re-commited this file too, presumably to get past this same issue. Googling this the other day I found there's a whole school of thought for disabling git mgmt of line-endings entirely because of anomalies like this :).
Tiago Costa
Posts: 12
Joined: Mon Apr 28, 2014 5:35 pm

Re: File keeping listed as changed

Post by Tiago Costa »

I ended removing and adding the troublesome file and the problem went away :D.
infidel
Developer
Posts: 571
Joined: Thu Jul 12, 2012 5:37 am

Re: File keeping listed as changed

Post by infidel »

Great! Also, as much as we like your prs, maybe now's the time to close the duplicate ones ;).
Tiago Costa
Posts: 12
Joined: Mon Apr 28, 2014 5:35 pm

Re: File keeping listed as changed

Post by Tiago Costa »

Done! Thanks for the tip of "Close" in Comments Box. I'm still new to Pull Requests, feeling lost sometimes.
Post Reply