diff-lib: drop return value from do_diff_cache()
PATCH 1/1 diff-lib: drop return value from do_diff_cache()
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 <[email protected]>
---
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(-)
builtin/reset.c +1 -2
@@ -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-lib.c +1 -2
@@ -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.h +1 -1
@@ -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 );
Signature · 1 line
1.8.1.2.536.gf441e6d