Mission: Using Git - Creating a Patch
  • snowyash April 2014
    Hi, this is the steps I was told to follow:

    Your mission is this: The file hello.py contains a terrible error. Fix it in your working copy to print "Hello world!", rather than "Goodbye world!". Submit your changes as a format-patch file. (You can use your working copy from the previous mission.)

    Edit the file to fix the error. Remember that you need to edit files before running git commands!
    Tell git you want to prepare these changes for committing: git add hello.py
    Tell git you want to record those changes as a commit, and provide a short message to summarize your commit. For example: git commit -m "Fixed hello world"
    Create a file containing the patch: git format-patch origin/master
    Open the patch file with a text editor and paste the results in the box below.

    I followed it exactly and got this in 0001-Fixed-hello-world.patch:
    From b321a9324f6ce784a2b78d2299c706082590b40e Mon Sep 17 00:00:00 2001
    From: snowyash
    Date: Tue, 15 Apr 2014 17:38:04 -0700
    Subject: [PATCH] Fixed hello world

    hello.py | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/hello.py b/hello.py
    index a14159b..7356bfe 100644
    --- a/hello.py
    +++ b/hello.py
    @@ -1,3 +1,3 @@
    #! /usr/bin/env python

    -print "Goodbye world!"
    +print “Hello world!"
    -- (Apple Git-48)

    ***But the webpage is saying "Something doesn't look right.The expected line is '+print... ' Give it another try!" when I enter this information and click submit??? I have no idea why it went wrong, maybe I'm missing something? Please help! Thx u!
  • griffinashe April 2014
    I'm having the same issue.
  • paulproteus April 2014
    Hey all,

    I think the problem here is that your editor is creating "curly quotes" -- compare the quote marks in the original "Goodbye, world!" line with the one before the word Hello in yours.

    Let me know if that helps!
  • griffinashe April 2014
    Hi Paul,

    I'm not quite understanding what you mean by this, can you elaborate a little more?

  • paulproteus April 2014
    Hi again Griffin! Great to see you here again.

    Take a look at http://practicaltypography.com/straight-and-curly-quotes.html -- this is a website that tells you all about curly quotes and how they're great.

    The problem is that, in programming, you're supposed to not use curly quotes.

    If you're having trouble seeing this, zoom in really close (use your web browser's zoom functionality) on this line:

    +print “Hello world!"

    (which I've taken from your diff)

    Do you see how the first quotation mark is different from the last one?

    I think that's the problem you're running into.
  • sujitcse January 2015
    but i m succeeded :)

Welcome to the OpenHatch forums!

OpenHatch is a community of people aiming to help newcomers find their way into free software projects. If you like talking about that, please join the conversation!

Sign in or register (ignoreme)