1 files changed, 8 insertions(+), 1 deletions(-)
M forge-link
M forge-link => forge-link +8 -1
@@ 24,8 24,15 @@ if [ ! -e "${file}" ]; then
exit 1
fi
-gitroot=$(git rev-parse --show-toplevel)
+
abspath=$(readlink -e "${file}")
+
+# Make sure things work even if current directory is not in the same git
+# repository as target file. Makes integration code simpler.
+containing_dir=$(dirname "${file}")
+cd "${containing_dir}"
+
+gitroot=$(git rev-parse --show-toplevel)
relpath=${abspath##${gitroot}}
sha1=$(git rev-parse HEAD)