[gitg] commit: Fix invalid assignment from owned expression to unowned variable



commit 5b195d645fc5df06e099ac2dc501f5c10f173e29
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Mar 20 16:42:33 2017 +0100

    commit: Fix invalid assignment from owned expression to unowned variable
    
    commit is an unowned parameter of stage_submodule() and be used to keep
    an owned reference returned by repo.lookup().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780314

 gitg/commit/gitg-commit.vala |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index 3b82fa1..26af7dd 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -251,11 +251,12 @@ namespace GitgCommit
                                        return false;
                                }
 
-                               if (commit == null)
+                               Ggit.Commit sub_commit = commit;
+                               if (sub_commit == null)
                                {
                                        try
                                        {
-                                               commit = 
repo.lookup<Gitg.Commit>(sub.submodule.get_workdir_id());
+                                               sub_commit = 
repo.lookup<Gitg.Commit>(sub.submodule.get_workdir_id());
                                        }
                                        catch (Error e)
                                        {
@@ -268,7 +269,7 @@ namespace GitgCommit
 
                                try
                                {
-                                       yield stage.stage_commit(sub.path, commit);
+                                       yield stage.stage_commit(sub.path, sub_commit);
                                }
                                catch (Error e)
                                {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]