tree 6bce19032505c2939bf74eeca5e51aeefa4e1600
parent f07f7073f45a7f81e5b6cf26f5181e14fd051d81
author Brad Roberts <[EMAIL PROTECTED]> 1114086602 -0700
committer Brad Roberts <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
---

 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");
 

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to