quizzes/git: Add 'git commit --amend' question
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 14:27:43 +0000 (09:27 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 14:27:43 +0000 (09:27 -0500)
quizzes/git.json

index d3557878dbb4854567742dccc1472d8445216118..bd203e2bc315eb6180306d78c88afa4b4e0310e0 100644 (file)
                                "cat README"
                                ],
                        "help": "http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html"
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "git commit --amend",
+                       "prompt": "you messed up your README file in your last commit.\nyou just fixed the contents of `README`, but haven't added it to the index.\ncommit the new version so it also fixes the last commit.\nthe fixed commit message should be `Add a README`.",
+                       "multiline": true,
+                       "timeout": null,
+                       "answer": [
+                               "git commit --amend -am 'Add a 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 terrible' > README",
+                               "git add README",
+                               "git commit -am 'Add a README'",
+                               "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
+                               "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
+                               "echo 'This project is wonderful' > README"
+                               ],
+                       "teardown": [
+                               "git log -p",
+                               "git status"
+                               ],
+                       "help": "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html"
                }
        ]
 }