aboutsummaryrefslogtreecommitdiff
path: root/shortlog.h
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2013-09-17 03:06:14 -0400
committerJunio C Hamano <gitster@pobox.com>2013-09-17 10:07:13 -0700
commitdb5360f3f4966c4586d072bd1440880773185b81 (patch)
tree2df90653f56aecf73f7c644e543888e872eb5da8 /shortlog.h
parentb3e7d24ca19d841eb2c5c7fce7919ebb5d370a6f (diff)
downloadgit-db5360f3f4966c4586d072bd1440880773185b81.tar.gz
git-db5360f3f4966c4586d072bd1440880773185b81.tar.xz
name-hash: refactor polymorphic index_name_exists()
Depending upon the absence or presence of a trailing '/' on the incoming pathname, index_name_exists() checks either if a file is present in the index or if a directory is represented within the index. Each caller explicitly chooses the mode of operation by adding or removing a trailing '/' before invoking index_name_exists(). Since these two modes of operations are disjoint and have no code in common (one searches index_state.name_hash; the other dir_hash), they can be represented more naturally as distinct functions: one to search for a file, and one for a directory. Splitting index searching into two functions relieves callers of the artificial burden of having to add or remove a slash to select the mode of operation; instead they just call the desired function. A subsequent patch will take advantage of this benefit in order to eliminate the requirement that the incoming pathname for a directory search must have a trailing slash. (In order to avoid disturbing in-flight topics, index_name_exists() is retained as a thin wrapper dispatching either to index_dir_exists() or index_file_exists().) Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shortlog.h')
0 files changed, 0 insertions, 0 deletions