@@ -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;
}
@@ -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;
}
@@ -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
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@gmail.com> --- blame.c | 5 +++-- tree-walk.c | 9 ++++++--- tree-walk.h | 12 ++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-)