{"thread":{"id":"2686","subject":"[PATCH] cg-Xlib: use git-rev-parse to locate .git dir and set relpath","startedAt":"2005-11-27T15:55:21Z","lastAt":"2005-11-27T15:55:21Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"12803","messageId":"20051127155521.GA9558@diku.dk","threadId":"2686","inReplyTo":null,"subject":"[PATCH] cg-Xlib: use git-rev-parse to locate .git dir and set relpath","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-11-27T15:55:21Z","receivedAt":"2005-11-27T15:55:21Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\ndiff --git a/cg-Xlib b/cg-Xlib\nindex dedbb62..e3c365f 100755\n--- a/cg-Xlib\n+++ b/cg-Xlib\n@@ -502,16 +502,10 @@ fi\n \n _git=${GIT_DIR:-.git}\n if [ ! \"$_git_repo_unneeded\" ] && [ ! \"$GIT_DIR\" ] && [ ! -d $_git ]; then\n-\trootpath=.\n-\t# while not /\n-\twhile [ ! -d $rootpath/.git ] && [ \"$(stat -c %i $rootpath)\" != \"$(stat -c %i $rootpath/..)\" ]; do\n-\t\trootpath=../$rootpath\n-\tdone\n-\tif [ -d $rootpath/.git ]; then\n-\t\tmainpath=\"$(echo \"$(pwd)/$rootpath\" | normpath)\"\n-\t\t_git_relpath=$(pwd)/\n-\t\texport _git_relpath=${_git_relpath:$((${#mainpath}+1))}\n-\t\tcd \"$rootpath\"\n+\t_git_abs_path=\"$(git-rev-parse --git-dir 2>/dev/null)\"\n+\tif [ -d \"$_git_abs_path\" ]; then\n+\t\texport _git_relpath=\"$(git-rev-parse --show-prefix)\"\n+\t\tcd \"$_git_abs_path/..\"\n \tfi\n fi\n _git_objects=\"${GIT_OBJECT_DIRECTORY:-$_git/objects}\"\n\n-- \nJonas Fonseca\n"}]}