git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't create broken symlinks
@ 2005-09-20 15:59 Pavel Roskin
  0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-09-20 15:59 UTC (permalink / raw)
  To: git

cmd-rename.sh creates links for files that are not installed.
git-send-email is not installed by default, so git-send-email-script is
a broken link.

cmd-rename.sh should only create a link if the link target exists.
Also, the patchs add explicit exit codes for failures and ensures exit
code 0 if the script is successful.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/cmd-rename.sh b/cmd-rename.sh
--- a/cmd-rename.sh
+++ b/cmd-rename.sh
@@ -1,10 +1,12 @@
 #!/bin/sh
 d="$1"
-test -d "$d" || exit
+test -d "$d" || exit 1
 while read old new
 do
-	rm -f "$d/$old"
-	ln -s "$new" "$d/$old"
+	rm -f "$d/$old" || exit 1
+	if [ -f "$new/$d" ]; then
+		ln -s "$new" "$d/$old"
+	fi
 done <<\EOF
 git-add-script	git-add
 git-archimport-script	git-archimport
@@ -53,3 +55,5 @@ EOF
 # These two are a bit more than symlinks now.
 # git-ssh-push	git-ssh-upload
 # git-ssh-pull	git-ssh-fetch
+
+exit 0


-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-20 16:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-20 15:59 [PATCH] Don't create broken symlinks Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).