Git development
 help / color / mirror / Atom feed
From: Brad Roberts <braddr@gameboy2.puremagic.com>
To: git@vger.kernel.org
Subject: [PATCH 16/19] change all call sites that use the return value of read_cache to get the # of cache entries.
Date: Thu, 21 Apr 2005 11:38:36 -0700	[thread overview]
Message-ID: <200504211838.j3LIcahX027805@gameboy2.puremagic.com> (raw)

tree 6bce19032505c2939bf74eeca5e51aeefa4e1600
parent f07f7073f45a7f81e5b6cf26f5181e14fd051d81
author Brad Roberts <braddr@puremagic.com> 1114086602 -0700
committer Brad Roberts <braddr@gameboy2.puremagic.com> 1114086602 -0700

[PATCH] change all call sites that use the return value of read_cache to get the # of cache entries.

This patch somewhat breaks error handling for those call sites.  I'll fix
that in the next few patches.

Signed-off-by: Brad Roberts <braddr@puremagic.com>
---

 show-diff.c    |   13 ++++++++-----
 update-cache.c |    3 ++-
 write-tree.c   |    4 +++-
 3 files changed, 13 insertions(+), 7 deletions(-)

Index: show-diff.c
===================================================================
--- f07f7073f45a7f81e5b6cf26f5181e14fd051d81:1/show-diff.c  (mode:100644 sha1:e2642b65805b3e52a16c6309b44a92c2a2bd13c3)
+++ b965055600b8bf4927ea631446cd6cde714aef95:1/show-diff.c  (mode:100644 sha1:6e04e9182667cbb79afa4c878a31b685fdea3229)
@@ -126,10 +126,17 @@
 	int silent_on_nonexisting_files = 0;
 	int machine_readable = 0;
 	int reverse = 0;
-	int entries = read_cache();
+	int entries;
 	int matched = 0;
 	int i;
 
+	read_cache();
+	entries = get_num_cache_entries();
+	if (entries < 0) {
+		perror("read_cache");
+		exit(1);
+	}
+
 	while (1 < argc && argv[1][0] == '-') {
 		if  (!strcmp(argv[1], "-R"))
 			reverse = 1;
@@ -147,10 +154,6 @@
 	/* At this point, if argc == 1, then we are doing everything.
 	 * Otherwise argv[1] .. argv[argc-1] have the explicit paths.
 	 */
-	if (entries < 0) {
-		perror("read_cache");
-		exit(1);
-	}
 	prepare_diff_cmd();
 	for (i = 0; i < entries; i++) {
 		struct stat st;
Index: update-cache.c
===================================================================
--- f07f7073f45a7f81e5b6cf26f5181e14fd051d81:1/update-cache.c  (mode:100644 sha1:e741f593eb9c56c596fabed7eb6b79dee2d8cba9)
+++ b965055600b8bf4927ea631446cd6cde714aef95:1/update-cache.c  (mode:100644 sha1:8328975cb726f5e06a413a9f0099bfa2f81d3381)
@@ -299,7 +299,8 @@
 	atexit(remove_lock_file);
 	remove_lock = 1;
 
-	entries = read_cache();
+	read_cache();
+	entries = get_num_cache_entries();
 	if (entries < 0)
 		die("cache corrupted");
 
Index: write-tree.c
===================================================================
--- f07f7073f45a7f81e5b6cf26f5181e14fd051d81:1/write-tree.c  (mode:100644 sha1:f1b12cdde1bb446a134a121760007150008b251a)
+++ b965055600b8bf4927ea631446cd6cde714aef95:1/write-tree.c  (mode:100644 sha1:92e707fd4780805da160ce6fa282e75111ea67b9)
@@ -101,9 +101,11 @@
 int main(int argc, char **argv)
 {
 	int i, unmerged;
-	int entries = read_cache();
+	int entries;
 	unsigned char sha1[20];
 
+	read_cache();
+	entries = get_num_cache_entries();
 	if (entries <= 0)
 		die("write-tree: no cache contents to write");
 


                 reply	other threads:[~2005-04-21 18:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200504211838.j3LIcahX027805@gameboy2.puremagic.com \
    --to=braddr@gameboy2.puremagic.com \
    --cc=git@vger.kernel.org \
    /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