* git-mv: fully detect 'directory moved into itself'
@ 2005-11-27 21:06 Josef Weidendorfer
2005-11-28 6:54 ` Matthias Urlichs
0 siblings, 1 reply; 4+ messages in thread
From: Josef Weidendorfer @ 2005-11-27 21:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
This gives a better error message when trying to move a directory
into some subdirectory of itself; ie. no real bug fix: renaming
already failed before, but with a strange "invalid argument".
Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
---
git-mv.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
applies-to: 5d83477de7a407ab0ef183c6676114e1a507cf86
29b01f820bf24c4b697765a2a117c880a730b205
diff --git a/git-mv.perl b/git-mv.perl
index ac19876..8d294d6 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -108,7 +108,7 @@ while(scalar @srcArgs > 0) {
}
}
- if (($bad eq "") && ($src eq $dstDir)) {
+ if (($bad eq "") && ($dst =~ /^$src\//)) {
$bad = "can not move directory '$src' into itself";
}
---
0.99.9.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: git-mv: fully detect 'directory moved into itself'
2005-11-27 21:06 git-mv: fully detect 'directory moved into itself' Josef Weidendorfer
@ 2005-11-28 6:54 ` Matthias Urlichs
2005-11-28 9:15 ` [PATCH] " Josef Weidendorfer
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Urlichs @ 2005-11-28 6:54 UTC (permalink / raw)
To: git
Hi, Josef Weidendorfer wrote:
> + if (($bad eq "") && ($dst =~ /^$src\//)) {
That should be
> + if (($bad eq "") && ($dst =~ /^\Q$src\E\//)) {
otherwise you will mistakenly match "foo-bar" with "foo.bar".
--
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
- -
If people drank ink instead of Schlitz, they'd be better off.
-- Edward E. Hippensteel
[What brand of ink? Ed.]
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] git-mv: fully detect 'directory moved into itself'
2005-11-28 6:54 ` Matthias Urlichs
@ 2005-11-28 9:15 ` Josef Weidendorfer
2005-11-28 9:24 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Josef Weidendorfer @ 2005-11-28 9:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
This gives a better error message when trying to move a directory
into some subdirectory of itself; ie. no real bug fix: renaming
already failed before, but with a strange "invalid argument".
Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
---
This is a corrected version.
On Monday 28 November 2005 07:54, Matthias Urlichs wrote:
> Hi, Josef Weidendorfer wrote:
>
> > + if (($bad eq "") && ($dst =~ /^$src\//)) {
>
> That should be
>
> > + if (($bad eq "") && ($dst =~ /^\Q$src\E\//)) {
>
> otherwise you will mistakenly match "foo-bar" with "foo.bar".
>
Ah, thanks.
You never end learning.
Josef
git-mv.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
applies-to: 5d83477de7a407ab0ef183c6676114e1a507cf86
3c1ed8adaff3f7492ef2afdb5585ae7412a02817
diff --git a/git-mv.perl b/git-mv.perl
index ac19876..bfe3c29 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -108,7 +108,7 @@ while(scalar @srcArgs > 0) {
}
}
- if (($bad eq "") && ($src eq $dstDir)) {
+ if (($bad eq "") && ($dst =~ /^\Q$src\E\//)) {
$bad = "can not move directory '$src' into itself";
}
---
0.99.9.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] git-mv: fully detect 'directory moved into itself'
2005-11-28 9:15 ` [PATCH] " Josef Weidendorfer
@ 2005-11-28 9:24 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-11-28 9:24 UTC (permalink / raw)
To: Josef Weidendorfer; +Cc: git
Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:
> This is a corrected version.
>
> On Monday 28 November 2005 07:54, Matthias Urlichs wrote:
>> Hi, Josef Weidendorfer wrote:
>>
>> > + if (($bad eq "") && ($dst =~ /^$src\//)) {
>>
>> That should be
>>
>> > + if (($bad eq "") && ($dst =~ /^\Q$src\E\//)) {
>>
>> otherwise you will mistakenly match "foo-bar" with "foo.bar".
>
> Ah, thanks.
> You never end learning.
Why not use $safesrc you already have for this exact purpose?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-11-28 9:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-27 21:06 git-mv: fully detect 'directory moved into itself' Josef Weidendorfer
2005-11-28 6:54 ` Matthias Urlichs
2005-11-28 9:15 ` [PATCH] " Josef Weidendorfer
2005-11-28 9:24 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox