From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] diff-lib: drop return value from do_diff_cache()
Date: Mon, 25 Feb 2013 21:00:45 +0700 [thread overview]
Message-ID: <1361800845-21958-1-git-send-email-pclouds@gmail.com> (raw)
Since 204ce97 (Also use unpack_trees() in do_diff_cache() -
2008-01-20), do_diff_cache() always returns zero. It does not make
sense to check its return value any more.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
I don't know the history behind this function. But it feels not right
to do exit(128) in do_diff_cache (since 203a2fe (Allow callers of
unpack_trees() to handle failure - 2008-02-07) and limit the caller's
control here.
builtin/reset.c | 3 +--
diff-lib.c | 3 +--
diff.h | 2 +-
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/builtin/reset.c b/builtin/reset.c
index 6032131..843d337 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -140,8 +140,7 @@ static int read_from_tree(const char **pathspec, unsigned char *tree_sha1)
opt.format_callback = update_index_from_diff;
read_cache();
- if (do_diff_cache(tree_sha1, &opt))
- return 1;
+ do_diff_cache(tree_sha1, &opt);
diffcore_std(&opt);
diff_flush(&opt);
diff_tree_release_paths(&opt);
diff --git a/diff-lib.c b/diff-lib.c
index f35de0f..5a5fc94 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -495,7 +495,7 @@ int run_diff_index(struct rev_info *revs, int cached)
return 0;
}
-int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
+void do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
{
struct rev_info revs;
@@ -505,7 +505,6 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
if (diff_cache(&revs, tree_sha1, NULL, 1))
exit(128);
- return 0;
}
int index_differs_from(const char *def, int diff_flags)
diff --git a/diff.h b/diff.h
index 78b4091..aaa9a4e 100644
--- a/diff.h
+++ b/diff.h
@@ -319,7 +319,7 @@ extern const char *diff_unique_abbrev(const unsigned char *, int);
extern int run_diff_files(struct rev_info *revs, unsigned int option);
extern int run_diff_index(struct rev_info *revs, int cached);
-extern int do_diff_cache(const unsigned char *, struct diff_options *);
+extern void do_diff_cache(const unsigned char *, struct diff_options *);
extern int diff_flush_patch_id(struct diff_options *, unsigned char *);
extern int diff_result_code(struct diff_options *, int);
--
1.8.1.2.536.gf441e6d
reply other threads:[~2013-02-25 14:00 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=1361800845-21958-1-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.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;
as well as URLs for NNTP newsgroup(s).