[git-cl] refactor Change-Id manipulation in squash upload mode.

R=iannucci@chromium.org

Bug:

Change-Id: Ia1729175c9f10d7c89388bf1e227904e76cbb16c
Reviewed-on: https://chromium-review.googlesource.com/482319
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index bd06467..fec5b74 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2875,6 +2875,7 @@
           if options.title:
             message = options.title + '\n\n' + message
         change_desc = ChangeDescription(message)
+
         if not options.force:
           change_desc.prompt(bug=options.bug)
         # On first upload, patchset title is always this string, while
@@ -2883,16 +2884,15 @@
         automatic_title = True
         if not change_desc.description:
           DieWithError("Description is empty. Aborting...")
-        message = change_desc.description
-        change_ids = git_footers.get_footer_change_id(message)
+        change_ids = git_footers.get_footer_change_id(change_desc.description)
         if len(change_ids) > 1:
           DieWithError('too many Change-Id footers, at most 1 allowed.')
         if not change_ids:
           # Generate the Change-Id automatically.
-          message = git_footers.add_footer_change_id(
-              message, GenerateGerritChangeId(message))
-          change_desc.set_description(message)
-          change_ids = git_footers.get_footer_change_id(message)
+          change_desc.set_description(git_footers.add_footer_change_id(
+              change_desc.description,
+              GenerateGerritChangeId(change_desc.description)))
+          change_ids = git_footers.get_footer_change_id(change_desc.description)
           assert len(change_ids) == 1
         change_id = change_ids[0]