List for cgit developers and users
 help / color / mirror / Atom feed
From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: [PATCH 3/3] ui-patch: Rename variables
Date: Thu, 15 Aug 2013 19:06:36 +0200	[thread overview]
Message-ID: <1376586396-27850-4-git-send-email-cgit@cryptocrack.de> (raw)
In-Reply-To: <1376586396-27850-1-git-send-email-cgit@cryptocrack.de>

Rename parameters and local variables to match those from ui-diff. Also,
convert a "char *" to "const char *".

Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
 ui-patch.c | 28 +++++++++++++++-------------
 ui-patch.h |  3 ++-
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/ui-patch.c b/ui-patch.c
index a93ba45..3d124af 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -11,38 +11,40 @@
 #include "html.h"
 #include "ui-shared.h"
 
-void cgit_print_patch(char *hex, const char *old_rev, const char *prefix)
+void cgit_print_patch(const char *new_rev, const char *old_rev,
+		      const char *prefix)
 {
 	struct rev_info rev;
 	struct commit *commit;
-	unsigned char sha1[20], old_sha1[20];
+	unsigned char new_rev_sha1[20], old_rev_sha1[20];
 	char rev_range[2 * 20 + 2];
 	char *rev_argv[] = { NULL, "--reverse", rev_range };
 	char *patchname;
 
-	if (!hex)
-		hex = ctx.qry.head;
+	if (!new_rev)
+		new_rev = ctx.qry.head;
 
-	if (get_sha1(hex, sha1)) {
-		cgit_print_error("Bad object id: %s", hex);
+	if (get_sha1(new_rev, new_rev_sha1)) {
+		cgit_print_error("Bad object id: %s", new_rev);
 		return;
 	}
-	commit = lookup_commit_reference(sha1);
+	commit = lookup_commit_reference(new_rev_sha1);
 	if (!commit) {
-		cgit_print_error("Bad commit reference: %s", hex);
+		cgit_print_error("Bad commit reference: %s", new_rev);
 		return;
 	}
 
 	if (old_rev)
-		get_sha1(old_rev, old_sha1);
+		get_sha1(old_rev, old_rev_sha1);
 	else if (commit->parents && commit->parents->item)
-		hashcpy(old_sha1, commit->parents->item->object.sha1);
+		hashcpy(old_rev_sha1, commit->parents->item->object.sha1);
 	else
-		hashclr(old_sha1);
+		hashclr(old_rev_sha1);
 
-	sprintf(rev_range, "%s..%s", sha1_to_hex(old_sha1), sha1_to_hex(sha1));
+	sprintf(rev_range, "%s..%s", sha1_to_hex(old_rev_sha1),
+		sha1_to_hex(new_rev_sha1));
 
-	patchname = fmt("%s.patch", sha1_to_hex(sha1));
+	patchname = fmt("%s.patch", sha1_to_hex(new_rev_sha1));
 	ctx.page.mimetype = "text/plain";
 	ctx.page.filename = patchname;
 	cgit_print_http_headers(&ctx);
diff --git a/ui-patch.h b/ui-patch.h
index acd37fd..7a6cacd 100644
--- a/ui-patch.h
+++ b/ui-patch.h
@@ -1,6 +1,7 @@
 #ifndef UI_PATCH_H
 #define UI_PATCH_H
 
-extern void cgit_print_patch(char *hex, const char *old_rev, const char *prefix);
+extern void cgit_print_patch(const char *new_rev, const char *old_rev,
+			     const char *prefix);
 
 #endif /* UI_PATCH_H */
-- 
1.8.4.rc2.477.g1da3ebd



      parent reply	other threads:[~2013-08-15 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 17:06 [PATCH 0/3] `git format-patch --stdout id2..id` cgit
2013-08-15 17:06 ` [PATCH 1/3] ui-patch.c: Use log_tree_commit() to generate diffs cgit
2013-08-15 18:37   ` Jason
2013-08-15 18:52     ` cgit
2013-08-15 17:06 ` [PATCH 2/3] Allow for creating patch series cgit
2013-08-15 21:04   ` john
2013-08-15 17:06 ` cgit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376586396-27850-4-git-send-email-cgit@cryptocrack.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).