All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: git <git@vger.kernel.org>
Subject: [PATCH] Don't create broken symlinks
Date: Tue, 20 Sep 2005 11:59:55 -0400	[thread overview]
Message-ID: <1127231995.8374.6.camel@dv> (raw)

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

                 reply	other threads:[~2005-09-20 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1127231995.8374.6.camel@dv \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.