There are a bunch of different situations in which one would like to have an absolute and canonical or a relative path from Git. In many of these cases, these values are already available from git rev-parse, but some values only come in one form or another. Changes from v3: * Switch to a binary option instead of a number of missing path components to skip. Changes from v2: * Incorporate multiple missing segment support into the strbuf_realpath code. * Switch some invocations to use DEFAULT_UNMODIFIED, which should not result in a change in behavior. * Rebase, resolving some conflicts. Changes from v1: * Add a function to handle missing trailing components when canonicalizing paths and use it. * Improve commit messages. * Fix broken && chain. * Fix situation where relative paths are not relative. brian m. carlson (2): abspath: add a function to resolve paths with missing components rev-parse: add option for absolute or relative path formatting Documentation/git-rev-parse.txt | 71 +++++++++++++--------- abspath.c | 13 +++- builtin/rev-parse.c | 104 ++++++++++++++++++++++++++++---- cache.h | 2 + t/t1500-rev-parse.sh | 57 ++++++++++++++++- 5 files changed, 203 insertions(+), 44 deletions(-)