Git development
 help / color / mirror / Atom feed
From: Matthias Urlichs <smurf@smurf.noris.de>
To: Chris Wedgwood <cw@f00f.org>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)
Date: Wed, 13 Jul 2005 22:07:24 +0200	[thread overview]
Message-ID: <20050713200724.GN9915@kiste.smurf.noris.de> (raw)
In-Reply-To: <20050713185339.GA9260@taniwha.stupidest.org>

Hi,

Chris Wedgwood:
> How about the following?
> 
Ummm...

> 	    local NLINK=`readlink "$DEST"`
> 
> 	    if [ ! -e "$NLINK" ] ; then

You lose if the link is relative and the symlink is not in the current
directory. You also lose on systems where the empty filename is
synonymous with the current directory.

You'd need to do something along the lines of

	if [ -n "$NLINK" ] ; then
		case "$NLINK" in
		/*) ;;
		*) NLINK="$(dirname "$DEST")/$NLINK" ;;
		esac
	fi

first.

> 		# dangling link, just poke as-is
> 		echo "$1" > "$DEST"

You should remove "DEST first. Otherwise, under Linux, you'll magically
create the file the symlink points to, which may not be what you want to
do.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Custom does often reason overrule And only serves for reason to the fool.
					-- John Wilmot, Earl of Rochester

  parent reply	other threads:[~2005-07-13 20:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-12 19:05 [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use) Chris Wedgwood
2005-07-12 21:37 ` Junio C Hamano
2005-07-13  4:53   ` Chris Wedgwood
2005-07-13  7:03     ` Matthias Urlichs
2005-07-13 18:53       ` Chris Wedgwood
2005-07-13 20:05         ` Linus Torvalds
2005-07-13 20:44           ` Chris Wedgwood
2005-07-13 21:05             ` Linus Torvalds
2005-07-13 21:11               ` Chris Wedgwood
2005-07-13 21:33                 ` Linus Torvalds
2005-07-13 21:50                   ` Chris Wedgwood
2005-07-13 20:07         ` Matthias Urlichs [this message]
2005-07-13 20:36           ` Chris Wedgwood
2005-07-13 21:23         ` Linus Torvalds
2005-07-13 21:54           ` Chris Wedgwood

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=20050713200724.GN9915@kiste.smurf.noris.de \
    --to=smurf@smurf.noris.de \
    --cc=cw@f00f.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox