Do formatting (mainly whitespace) changes of code around the get_tree_entry() function to make a subsequent change where we'll add a sister function easier to read. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- blame.c | 5 +++-- tree-walk.c | 9 ++++++--- tree-walk.h | 12 ++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/blame.c b/blame.c index a5044fcfaa6..83babc41d08 100644 --- a/blame.c +++ b/blame.c @@ -102,9 +102,10 @@ static void verify_working_tree_path(struct repository *r, const struct object_id *commit_oid = &parents->item->object.oid; struct object_id blob_oid; unsigned short mode; + int ret = get_tree_entry(r, commit_oid, path, &blob_oid, + &mode); - if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode) && - oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB) + if (!ret && oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB) return; } diff --git a/tree-walk.c b/tree-walk.c index 6e9161901d8..e88187e3714 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -591,7 +591,8 @@ static int find_tree_entry(struct repository *r, struct tree_desc *t, oidcpy(result, &oid); return 0; } - return get_tree_entry(r, &oid, name + entrylen, result, mode); + return get_tree_entry(r, &oid, name + entrylen, result, + mode); } return -1; } @@ -622,7 +623,8 @@ int get_tree_entry(struct repository *r, } else { struct tree_desc t; init_tree_desc(&t, tree, size); - retval = find_tree_entry(r, &t, name, oid, mode); + retval = find_tree_entry(r, &t, name, oid, + mode); } free(tree); return retval; @@ -748,7 +750,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r, /* Look up the first (or only) path component in the tree. */ find_result = find_tree_entry(r, &t, namebuf.buf, - ¤t_tree_oid, mode); + ¤t_tree_oid, + mode); if (find_result) { goto done; } diff --git a/tree-walk.h b/tree-walk.h index 9f3825d2773..478a659ee2b 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -169,10 +169,14 @@ struct traverse_info { /** * Find an entry in a tree given a pathname and the sha1 of a tree to - * search. Returns 0 if the entry is found and -1 otherwise. The third - * and fourth parameters are set to the entry's sha1 and mode respectively. - */ -int get_tree_entry(struct repository *, const struct object_id *, const char *, struct object_id *, unsigned short *); + * search. Returns 0 if the entry is found and -1 otherwise. + * + * The third and fourth parameters are set to the entry's sha1 and + * mode respectively. + */ +int get_tree_entry(struct repository *, const struct object_id *, const char *, + struct object_id *, + unsigned short *); /** * Generate the full pathname of a tree entry based from the root of the -- 2.31.0.rc0.126.g04f22c5b82