git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Clemens Buchacher <drizzd@aon.at>
Cc: Johannes Sixt <j6t@kdbg.org>, git@vger.kernel.org
Subject: Re: [PATCH] do not overwrite untracked symlinks
Date: Mon, 21 Feb 2011 22:54:38 -0800	[thread overview]
Message-ID: <7v62scftjl.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20110221194623.GA31181@localhost> (Clemens Buchacher's message of "Mon\, 21 Feb 2011 20\:46\:23 +0100")

Clemens Buchacher <drizzd@aon.at> writes:

> I didn't write the test, but to me it looks like the test wants to
> make sure that while the symlink is removed, the tree it's pointing
> to is not removed.

Yes, I agree with that reading.  I'd squash in this on top, first making
sure that "do not overwrite untracked symlinks" (which is the title of
this patch) won't be broken, and then the original test that wanted to
make sure that checking out a/b/c/d when a/b is pointing to an unrelated
part of the tree does not nuke whatever is pointed at that symbolic link.

Thanks.

My unhappiness with the undescriptive "check_leading_path()" still
remains, though...

diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
index 1de285b..2599ae5 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6035-merge-dir-to-symlink.sh
@@ -17,13 +17,21 @@ test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink'
 	git commit -m "dir to symlink"
 '
 
-test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
+test_expect_success SYMLINKS 'checkout does not clobber untracked symlink' '
 	git checkout HEAD^0 &&
 	git reset --hard master &&
 	git rm --cached a/b &&
 	git commit -m "untracked symlink remains" &&
-	 git checkout -f start^0 &&
-	 test -f a/b-2/c/d
+	test_must_fail git checkout start^0
+'
+
+test_expect_success SYMLINKS 'a/b-2/c/d is kept when clobbering symlink b' '
+	git checkout HEAD^0 &&
+	git reset --hard master &&
+	git rm --cached a/b &&
+	git commit -m "untracked symlink remains" &&
+	git checkout -f start^0 &&
+	test -f a/b-2/c/d
 '
 
 test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' '

  reply	other threads:[~2011-02-22  6:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 19:25 untracked symlinks are less precious than untracked files? Johannes Sixt
2011-02-02 20:03 ` Junio C Hamano
2011-02-02 22:24   ` Johannes Sixt
2011-02-05 18:18     ` [PATCH] Demonstrate breakage: checkout overwrites untracked symlink with directory Johannes Sixt
2011-02-05 18:33       ` Clemens Buchacher
2011-02-09 23:48         ` Junio C Hamano
2011-02-10 21:49           ` Clemens Buchacher
2011-02-20 12:13         ` [PATCH] do not overwrite untracked symlinks Clemens Buchacher
2011-02-21  7:15           ` Junio C Hamano
2011-02-21 19:46             ` Clemens Buchacher
2011-02-22  6:54               ` Junio C Hamano [this message]
2011-02-22 19:26                 ` Clemens Buchacher
2011-02-22 20:01                   ` Junio C Hamano
2011-02-15  7:24       ` [PATCH] Demonstrate breakage: checkout overwrites untracked symlink with directory Johannes Sixt

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7v62scftjl.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).