def get_diff_from_line(self, line_no, reset):
        hunks = diff_view_hunks[self.view.id()]
        add_length_earlier_in_diff = 0

        # Find the correct hunk.
        for hunk_ref in hunks:
            if hunk_ref.section_start <= line_no and hunk_ref.section_end >= line_no:
                break
            else:
                # we loop through all hooks before selected hunk.
                # used create a correct diff when stage, unstage
                # need to make undo work properly.
                for type in hunk_ref.line_types:
                    if type == "+":
                        add_length_earlier_in_diff += 1
                    elif type == "-":
                        add_length_earlier_in_diff -= 1
                    else:
                        # should never happen that it will raise.
                        raise ValueError('type have to be eather "+" or "-"')

        # Correct hunk not found.
        else:
            return

        stand_alone_header = \
            "@@ -{head_start},{head_length} +{new_start},{new_length} @@".format(
                head_start=hunk_ref.hunk.head_start + (add_length_earlier_in_diff if reset else 0),
                head_length=hunk_ref.hunk.head_length,
                # If head_length is zero, diff will report original start position
                # as one less than where the content is inserted, for example:
                #   @@ -75,0 +76,3 @@
                new_start=hunk_ref.hunk.head_start + (0 if hunk_ref.hunk.head_length else 1),
                new_length=hunk_ref.hunk.saved_length
            )

        return "\n".join([stand_alone_header] + hunk_ref.hunk.raw_lines[1:])
dataset/ETHPy150Open divmain/GitSavvy/core/commands/inline_diff.py/GsInlineDiffStageOrResetHunkCommand.get_diff_from_line/original