{"thread":{"id":"1883","subject":"[PATCH] Don't create broken symlinks","startedAt":"2005-09-20T15:59:55Z","lastAt":"2005-09-20T15:59:55Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"8995","messageId":"1127231995.8374.6.camel@dv","threadId":"1883","inReplyTo":null,"subject":"[PATCH] Don't create broken symlinks","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-09-20T15:59:55Z","receivedAt":"2005-09-20T15:59:55Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"cmd-rename.sh creates links for files that are not installed.\ngit-send-email is not installed by default, so git-send-email-script is\na broken link.\n\ncmd-rename.sh should only create a link if the link target exists.\nAlso, the patchs add explicit exit codes for failures and ensures exit\ncode 0 if the script is successful.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/cmd-rename.sh b/cmd-rename.sh\n--- a/cmd-rename.sh\n+++ b/cmd-rename.sh\n@@ -1,10 +1,12 @@\n #!/bin/sh\n d=\"$1\"\n-test -d \"$d\" || exit\n+test -d \"$d\" || exit 1\n while read old new\n do\n-\trm -f \"$d/$old\"\n-\tln -s \"$new\" \"$d/$old\"\n+\trm -f \"$d/$old\" || exit 1\n+\tif [ -f \"$new/$d\" ]; then\n+\t\tln -s \"$new\" \"$d/$old\"\n+\tfi\n done <<\\EOF\n git-add-script\tgit-add\n git-archimport-script\tgit-archimport\n@@ -53,3 +55,5 @@ EOF\n # These two are a bit more than symlinks now.\n # git-ssh-push\tgit-ssh-upload\n # git-ssh-pull\tgit-ssh-fetch\n+\n+exit 0\n\n\n-- \nRegards,\nPavel Roskin\n"}]}