Commit Diff


commit - c7d5c43cafada3470647a8b876d489018002f713
commit + 3ef734a17cb66c5ec85cdacaddc8be15237dcf69
blob - 15d9ab77ce628dc6b1939507cdf0e236943d6b82
blob + 77ab232b3e3dd99d8500f2e4792976396ecafda9
--- got/got.c
+++ got/got.c
@@ -7478,11 +7478,6 @@ cmd_tag(int argc, char *argv[])
 			if (error)
 				goto done;
 		}
-		if (worktree) {
-			/* Release work tree lock. */
-			got_worktree_close(worktree);
-			worktree = NULL;
-		}
 
 		if (tagmsg) {
 			if (signer_id) {
@@ -7513,6 +7508,12 @@ cmd_tag(int argc, char *argv[])
 				goto done;
 		}
 
+		if (worktree) {
+			/* Release work tree lock. */
+			got_worktree_close(worktree);
+			worktree = NULL;
+		}
+
 		error = add_tag(repo, tagger, tag_name,
 		    commit_id_str ? commit_id_str : commit_id_arg, tagmsg,
 		    signer_id, verbosity);