Re: [PATCH 02/18] http-push, http-walker: style fixes

Previous thread: [PATCH 03/18] http-walker: verify remote packs by Tay Ray Chuan on Sunday, May 24, 2009 - 7:19 am. (1 message)

Next thread: [PATCH 08/18] http*: move common variables and macros to http.[ch] by Tay Ray Chuan on Sunday, May 24, 2009 - 7:19 am. (2 messages)
From: Tay Ray Chuan
Date: Sunday, May 24, 2009 - 7:19 am

*spaces used as indentation have been replaced by tabs instead.

 *'if' and 'while' conditionals with a single line have had their curly
  braces removed.

 */*
   * We prefer this over...
   */

  /* comments like
   * this (notice the first line)
   */

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http-push.c   |   48 ++++++++++++++++++++-------------
 http-walker.c |   83 ++++++++++++++++++++++++++++++++++----------------------
 2 files changed, 79 insertions(+), 52 deletions(-)

diff --git a/http-push.c b/http-push.c
index 83d7235..024f05b 100644
--- a/http-push.c
+++ b/http-push.c
@@ -276,7 +276,7 @@ static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
 	struct transfer_request *request = (struct transfer_request *)data;
 	do {
 		ssize_t retval = xwrite(request->local_fileno,
-				       (char *) ptr + posn, size - posn);
+					(char *) ptr + posn, size - posn);
 		if (retval < 0)
 			return posn;
 		posn += retval;
@@ -289,7 +289,7 @@ static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
 		request->stream.avail_out = sizeof(expn);
 		request->zret = git_inflate(&request->stream, Z_SYNC_FLUSH);
 		git_SHA1_Update(&request->c, expn,
-			    sizeof(expn) - request->stream.avail_out);
+				sizeof(expn) - request->stream.avail_out);
 	} while (request->stream.avail_in && request->zret == Z_OK);
 	data_received++;
 	return size;
@@ -323,7 +323,8 @@ static void start_fetch_loose(struct transfer_request *request)
 		error("fd leakage in start: %d", request->local_fileno);
 	request->local_fileno = open(request->tmpfile,
 				     O_WRONLY | O_CREAT | O_EXCL, 0666);
-	/* This could have failed due to the "lazy directory creation";
+	/*
+	 * This could have failed due to the "lazy directory creation";
 	 * try to mkdir the last path component.
 	 */
 	if (request->local_fileno < 0 && errno == ENOENT) {
@@ -353,8 +354,10 @@ static void start_fetch_loose(struct transfer_request *request)
 	url = ...
From: Junio C Hamano
Date: Sunday, May 24, 2009 - 1:43 pm

We need to apply a style fix to your commit messages first.

Using '*' without any space as the enumeration bullet makes the message
harder to read.  Please don't.  Also we prefer to give orders to the
person who applies the patch (i.e. "do _this_, so that the result becomes
better in _this_ and _that_ way"), instead of saying "I've done this and
that".

	- Use tabs to indent, instead of spaces.

	- Do not use curly-braces around a single statement body in
          if/while statement; 

	- Do not start multi-line comment with description on the first
          line after "/*", i.e.
        
            /*
             * We prefer this over...
             */

            /* comments like
             * this (notice the first line)
             */

I personally do not necessarily agree with the first "clean-up", but as
long as the style is internally consistent within the file that's Ok.
--

From: Tay Ray Chuan
Date: Monday, May 25, 2009 - 5:03 am

Hi,


thanks for taking the time to go through this gargantuan series; your
suggestions and comments are really appreciated. I'll fix it soon.

-- 
Cheers,
Ray Chuan
--

Previous thread: [PATCH 03/18] http-walker: verify remote packs by Tay Ray Chuan on Sunday, May 24, 2009 - 7:19 am. (1 message)

Next thread: [PATCH 08/18] http*: move common variables and macros to http.[ch] by Tay Ray Chuan on Sunday, May 24, 2009 - 7:19 am. (2 messages)