haxwell / quizki

A question and answer database that generates exams.
http://www.quizki.com
GNU General Public License v2.0
4 stars 14 forks source link

resolve mysterious uncommitted change to questionChoiceItemView.html template #197

Closed jeremiah-shore closed 6 years ago

jeremiah-shore commented 6 years ago

Per the experiences of a few team members, when creating a new branch from the dev branch, the file questionChoiceItemView.html shows that it has uncommitted changes when nothing was actually changed.

This is possibly the result of reversion to a previous commit with uncommitted changes to this file.

possible solution(s):

haxwell commented 6 years ago

#197 - resolve mysterious uncommitted change to questionChoiceItemView.html template

haxwell commented 6 years ago

We need steps to reproduce this error, so as to understand it. Below, is my output, unsuccessfully trying to reproduce the issue.

jjames@johnathan-HPPAV02 ~/src/temp $ /usr/bin/git clone https://github.com/haxwell/quizki
Cloning into 'quizki'...
remote: Counting objects: 14585, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 14585 (delta 6), reused 14 (delta 6), pack-reused 14553
Receiving objects: 100% (14585/14585), 6.98 MiB | 1.82 MiB/s, done.
Resolving deltas: 100% (7936/7936), done.
Checking connectivity... done.
jjames@johnathan-HPPAV02 ~/src/temp $ cd quizki/

jjames@johnathan-HPPAV02 ~/src/temp/quizki $ git checkout dev
Branch dev set up to track remote branch dev from origin.
Switched to a new branch 'dev'

jjames@johnathan-HPPAV02 ~/src/temp/quizki $ git checkout -b newBranch
Switched to a new branch 'newBranch'

jjames@johnathan-HPPAV02 ~/src/temp/quizki $ git status
On branch newBranch
nothing to commit, working tree clean

jjames@johnathan-HPPAV02 ~/src/temp/quizki $ vi src/main/java/com/haxwell/apps/questions/dynamifiers/PhraseQuestionDynamifier.java 
jjames@johnathan-HPPAV02 ~/src/temp/quizki $ git status
On branch newBranch
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   src/main/java/com/haxwell/apps/questions/dynamifiers/PhraseQuestionDynamifier.java

no changes added to commit (use "git add" and/or "git commit -a")

jjames@johnathan-HPPAV02 ~/src/temp/quizki $ git commit -a -m "added a comment"
[newBranch 1c4da7d] added a comment
 1 file changed, 1 insertion(+)

jjames@johnathan-HPPAV02 ~/src/temp/quizki $ git status
On branch newBranch
nothing to commit, working tree clean
jjames@johnathan-HPPAV02 ~/src/temp/quizki $ 
jeremiah-shore commented 6 years ago

now that I got linux working, I'm also unable to recreate, I'll boot up in windows to see if I can recreate it from scratch there

jeremiah-shore commented 6 years ago

in windows with a fresh clone this is what I get--multiple git status at different stages for example:

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop
$ git clone https://github.com/haxwell/quizki.git
Cloning into 'quizki'...
remote: Counting objects: 14585, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 14585 (delta 6), reused 14 (delta 6), pack-reused 14553
Receiving objects: 100% (14585/14585), 6.98 MiB | 2.24 MiB/s, done.
Resolving deltas: 100% (7936/7936), done.

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop
$ cd quizki/

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop/quizki (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   src/main/webapp/templates/QuestionChoiceItemView.html

no changes added to commit (use "git add" and/or "git commit -a")

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop/quizki (master)
$ git checkout dev
M       src/main/webapp/templates/QuestionChoiceItemView.html
Branch dev set up to track remote branch dev from origin.
Switched to a new branch 'dev'

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop/quizki (dev)
$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   src/main/webapp/templates/QuestionChoiceItemView.html

no changes added to commit (use "git add" and/or "git commit -a")

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop/quizki (dev)
$ git checkout -b test
M       src/main/webapp/templates/QuestionChoiceItemView.html
Switched to a new branch 'test'

Jeremiah@DESKTOP-GPTQL52 MINGW64 ~/Desktop/quizki (test)
$ git status
On branch test
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   src/main/webapp/templates/QuestionChoiceItemView.html

no changes added to commit (use "git add" and/or "git commit -a")
FrauDeborah commented 6 years ago

I’m not at my computer right now. The screen print showed all the steps (after I deleted the repro and local). I forked your github, cloned to my local in git bash, set the upstream then after verifying upstream. I did a status command. Which showed the modified file.

Regards,

Deborah

On Mar 19, 2018, at 4:38 PM, Jeremiah Shore notifications@github.com wrote:

now that I got linux working, I'm also unable to recreate, I'll boot up in windows to see if I can recreate it from scratch there

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jeremiah-shore commented 6 years ago

Accidentally marked this as closed previously, I hit "close and comment" misinterpreting that to mean close the form... for some reason.

I did some more research, and I think this issue has to do with the difference in the way Windows and Linux file systems treat files. Apparently, in Windows the file system is technically case-insensitive, even if you can save files with the same name and varying cases in the same directory. From what I understand, in Linux, the filesystem is truly case sensitive with no behavioral workarounds. There's some more info in this stack overflow article: https://stackoverflow.com/questions/7199039/file-paths-in-windows-environment-not-case-sensitive

In my local copy of the cloned repo on Linux, there are two similarly named files: questionChoiceItemView.html and QuestionChoiceItemView.html. However, in the master branch on github, it only shows the one file with an uppercase 'Q'.

I'm not sure how it happened, but my best guess is that the file name was changed and committed on a Windows environment, but a copy was accidentally created, and somehow both files got pushed, even if one is a mystery (as to the singular appearance on gitHub).

As far as the git status message goes, I'm assuming that once cloned in windows, git sees the files as the same file because of the case insensitivity in Windows' file system, hence the perceived uncommitted changes.

@haxwell I'm assuming this might be enough to identify what happened, but please confirm when you get a moment so I know if I'm on the right path. As far as the code base goes, my next step is to check which version is actually used--I'm assuming the uppercase Q version--then, remove the unused file, push a commit to my repo, and clone/checkout in Windows to see if it's still there.

haxwell commented 6 years ago

@jeremiah-shore Thank you for digging in on this.. I believe I've resolved the issue by removing the file from the repo, and committing that change. Then I added the file back, and committed that change. I did this on both the Master and Dev branches. Can you try pulling the current to your machine, and let me know how it looks?

haxwell commented 6 years ago

Fixed with PR #204