git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] http-push: avoid a needless goto

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 14, 2008, 23:26 UTC
Message-ID
<alpine.LSU.1.00.0802142326040.30505@racer.site>
In-Reply-To
<alpine.LSU.1.00.0802142319340.30505@racer.site>

There was a goto, and while it is not half as harmful as some people believe, it was unnecessary here. So remove it for readability.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 http-push.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/http-push.c b/http-push.c
index 93bd87d..4862db6 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2404,12 +2404,9 @@ int main(int argc, char **argv)
 		} while (request_queue_head && !aborted);
 
 		/* Update the remote branch if all went well */
-		if (aborted || !update_remote(ref->new_sha1, ref_lock)) {
+		if (aborted || !update_remote(ref->new_sha1, ref_lock))
 			rc = 1;
-			goto unlock;
-		}
 
-	unlock:
 		if (!rc)
 			fprintf(stderr, "    done\n");
 		unlock_remote(ref_lock);
-- 
1.5.4.1.1353.g0d5dd
Previous: Johannes Schindelin
Message 8 of 8 in “http-push fixes”
  1. 0/3 http-push fixesJohannes Schindelin, Feb 14, 2008
  2. 1/3 http-push: avoid invalid memory accessesJohannes Schindelin, Feb 14, 2008
  3. Junio C HamanoFeb 16, 2008
  4. Mike HommeyFeb 16, 2008
  5. Johannes SchindelinFeb 16, 2008
  6. 2/3 http-push: do not get confused by submodulesJohannes Schindelin, Feb 14, 2008
  7. 2/3 http-push: do not get confused by submodulesJohannes Schindelin, Feb 14, 2008
  8. 3/3 http-push: avoid a needless gotoJohannes Schindelin, Feb 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.