quizzes/git: Add 'git diff *' questions
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 22:08:03 +0000 (17:08 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 22:21:26 +0000 (17:21 -0500)
New questions:
* git diff
* git diff HEAD --
* git diff HEAD -- README
* git diff --cached

quizzes/git.json

index c10a62a49f1b29ca377fbbe7763cd31985861758..ed4876962e29914608f59261f676489c787cc498 100644 (file)
                                "commit"
                                ]
                },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "git diff",
+                       "prompt": [
+                               "You've edited a few files since the last commit.",
+                               "Ask Git to display the changes you've make (but not staged)."
+                               ],
+                       "answer": "git diff",
+                       "setup": [
+                               "export GIT_AUTHOR_NAME='A U Thor'",
+                               "export GIT_AUTHOR_EMAIL=author@example.com",
+                               "export GIT_COMMITTER_NAME='C O Mitter'",
+                               "export GIT_COMMITTER_EMAIL=committer@example.com",
+                               "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
+                               "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
+                               "git init",
+                               "echo 'This project is wonderful' > README",
+                               "echo 'Lots of widgets' > widgets",
+                               "git add README widgets",
+                               "git commit -m 'Add some widgets'",
+                               "echo 'Take a look in the widgets file.' >> README",
+                               "echo 'Widget-1 should be blue' >> widgets"
+                               ],
+                       "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
+                       "tags": [
+                               "query"
+                               ]
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "git diff HEAD --",
+                       "prompt": [
+                               "You've edited a few files since the last commit.",
+                               "Ask Git to display the changes you've make since the last commit,",
+                               "including any changes that you may have already staged."
+                               ],
+                       "answer": "git diff HEAD --",
+                       "setup": [
+                               "export GIT_AUTHOR_NAME='A U Thor'",
+                               "export GIT_AUTHOR_EMAIL=author@example.com",
+                               "export GIT_COMMITTER_NAME='C O Mitter'",
+                               "export GIT_COMMITTER_EMAIL=committer@example.com",
+                               "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
+                               "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
+                               "git init",
+                               "echo 'This project is wonderful' > README",
+                               "echo 'Lots of widgets' > widgets",
+                               "git add README widgets",
+                               "git commit -m 'Add some widgets'",
+                               "echo 'Take a look in the widgets file.' >> README",
+                               "echo 'Widget-1 should be blue' >> widgets",
+                               "git add README"
+                               ],
+                       "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
+                       "tags": [
+                               "query"
+                               ]
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "git diff HEAD -- README",
+                       "prompt": [
+                               "You've edited a few files since the last commit.",
+                               "Ask Git to display the changes you've make to README since the last commit,",
+                               "including any changes that you may have already staged."
+                               ],
+                       "answer": "git diff HEAD -- README",
+                       "setup": [
+                               "export GIT_AUTHOR_NAME='A U Thor'",
+                               "export GIT_AUTHOR_EMAIL=author@example.com",
+                               "export GIT_COMMITTER_NAME='C O Mitter'",
+                               "export GIT_COMMITTER_EMAIL=committer@example.com",
+                               "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
+                               "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
+                               "git init",
+                               "echo 'This project is wonderful' > README",
+                               "echo 'Lots of widgets' > widgets",
+                               "git add README widgets",
+                               "git commit -m 'Add some widgets'",
+                               "echo 'Take a look in the widgets file.' >> README",
+                               "echo 'Widget-1 should be blue' >> widgets",
+                               "git add README"
+                               ],
+                       "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
+                       "tags": [
+                               "query"
+                               ]
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "git diff --cached",
+                       "prompt": [
+                               "You've edited a few files since the last commit, and staged some of them.",
+                               "Ask Git to display only the changes you've staged."
+                               ],
+                       "answer": "git diff --cached",
+                       "setup": [
+                               "export GIT_AUTHOR_NAME='A U Thor'",
+                               "export GIT_AUTHOR_EMAIL=author@example.com",
+                               "export GIT_COMMITTER_NAME='C O Mitter'",
+                               "export GIT_COMMITTER_EMAIL=committer@example.com",
+                               "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
+                               "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
+                               "git init",
+                               "echo 'This project is wonderful' > README",
+                               "echo 'Lots of widgets' > widgets",
+                               "git add README widgets",
+                               "git commit -m 'Add some widgets'",
+                               "echo 'Take a look in the widgets file.' >> README",
+                               "echo 'Widget-1 should be blue' >> widgets",
+                               "git add README"
+                               ],
+                       "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
+                       "tags": [
+                               "query"
+                               ]
+               },
                {
                        "class": "ScriptQuestion",
                        "interpreter": "sh",