]> git.ipfire.org Git - thirdparty/git.git/blobdiff - environment.c
l10n: tr: v2.33 (round 2)
[thirdparty/git.git] / environment.c
index 2f27008424a074c451a5037e40e241a9e8fccfa9..d6b22ede7ea2885d5649e59b00590c2b2a3fdf65 100644 (file)
@@ -253,21 +253,20 @@ static int git_work_tree_initialized;
  */
 void set_git_work_tree(const char *new_work_tree)
 {
-       struct strbuf realpath = STRBUF_INIT;
-
        if (git_work_tree_initialized) {
+               struct strbuf realpath = STRBUF_INIT;
+
                strbuf_realpath(&realpath, new_work_tree, 1);
                new_work_tree = realpath.buf;
                if (strcmp(new_work_tree, the_repository->worktree))
                        die("internal error: work tree has already been set\n"
                            "Current worktree: %s\nNew worktree: %s",
                            the_repository->worktree, new_work_tree);
+               strbuf_release(&realpath);
                return;
        }
        git_work_tree_initialized = 1;
        repo_set_worktree(the_repository, new_work_tree);
-
-       strbuf_release(&realpath);
 }
 
 const char *get_git_work_tree(void)