git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* cvs2git and file permissions
@ 2005-06-18 20:52 Sven Verdoolaege
  2005-06-18 21:23 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Verdoolaege @ 2005-06-18 20:52 UTC (permalink / raw
  To: Git Mailing List, Linus Torvalds

cvs2git currently drops mode information.
I've been bitten by this behaviour twice already.
The patch below fixes that, though not very cleanly.

skimo
--
git-cvs2git: propagate mode information

Let cvs checkout in a temporary directory rather than
using the pipe option to avoid loss of mode information.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>

---
commit df97fd9b709bd927f15adbc1a90ddfcfa79c7895
tree 0f223f52fdf7d61d7d1df0da1137a542811d27f9
parent fdf95bf8d4d1182db579bd25fe5e25811084eaa6
author Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 22:41:46 +0200
committer Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 22:41:46 +0200

 cvs2git.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cvs2git.c b/cvs2git.c
--- a/cvs2git.c
+++ b/cvs2git.c
@@ -196,10 +196,15 @@ static void update_file(char *line)
 	}
 
 	dir = strrchr(name, '/');
-	if (dir)
+	if (dir) {
 		printf("mkdir -p %.*s\n", (int)(dir - name), name);
+		printf("mkdir -p .git-tmp/%.*s\n", (int)(dir - name), name);
+	}
 
-	printf("cvs -q -d %s checkout -r%s -p '%s/%s' > '%s'\n", cvsroot, version, cvsmodule, name, name);
+	printf("cvs -q -d %s checkout -N -d .git-tmp -r%s '%s/%s'\n", 
+		cvsroot, version, cvsmodule, name);
+	printf("mv -f .git-tmp/%s/%s %s\n", cvsmodule, name, name);
+	printf("rm -rf .git-tmp\n");
 	printf("git-update-cache --add -- '%s'\n", name);
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cvs2git and file permissions
  2005-06-18 20:52 cvs2git and file permissions Sven Verdoolaege
@ 2005-06-18 21:23 ` Linus Torvalds
  2005-06-18 22:31   ` Sven Verdoolaege
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2005-06-18 21:23 UTC (permalink / raw
  To: skimo; +Cc: Git Mailing List



On Sat, 18 Jun 2005, Sven Verdoolaege wrote:
> 
> Let cvs checkout in a temporary directory rather than
> using the pipe option to avoid loss of mode information.

Hmm.. Why do you use the "-N" flag?

Wouldn't it be much cleaner to _not_ create all those sub-directories 
under ".git-tmp", and instead do something like

	"cvs -q -d %s checkout -d .git-tmp -r%s '%s/%s'" ...
	"mv -f .git-tmp/%s %s\n", dir ? dir+1 : name, name

With that changed (and tested ;), I'll happily take it.

		Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cvs2git and file permissions
  2005-06-18 21:23 ` Linus Torvalds
@ 2005-06-18 22:31   ` Sven Verdoolaege
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Verdoolaege @ 2005-06-18 22:31 UTC (permalink / raw
  To: Linus Torvalds; +Cc: Git Mailing List

On Sat, Jun 18, 2005 at 02:23:48PM -0700, Linus Torvalds wrote:
> On Sat, 18 Jun 2005, Sven Verdoolaege wrote:
> > 
> > Let cvs checkout in a temporary directory rather than
> > using the pipe option to avoid loss of mode information.
> 
> Hmm.. Why do you use the "-N" flag?

I didn't quite know how to interpret the "as short as possible" in

              Use the -d dir option to create a directory  called
              dir  for  the  working  files, instead of using the
              module name.  Unless you also  use  -N,  the  paths
              created under dir will be as short as possible.

It would appear you do.

> Wouldn't it be much cleaner to _not_ create all those sub-directories 
> under ".git-tmp", and instead do something like
> 
> 	"cvs -q -d %s checkout -d .git-tmp -r%s '%s/%s'" ...
> 	"mv -f .git-tmp/%s %s\n", dir ? dir+1 : name, name
> 
> With that changed (and tested ;), I'll happily take it.

Seems to work.

The rm is still needed though.  Without it, cvs can get confused.

skimo
--
git-cvs2git: propagate mode information

Let cvs checkout in a temporary directory rather than
using the pipe option to avoid loss of mode information.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>

---
commit 188ea2ee70413147fc1b80fedc3fbee02843e590
tree f122fcf591013aff299a4d072eed47255892d3a1
parent fdf95bf8d4d1182db579bd25fe5e25811084eaa6
author Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 23:55:49 +0200
committer Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 23:55:49 +0200

 cvs2git.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/cvs2git.c b/cvs2git.c
--- a/cvs2git.c
+++ b/cvs2git.c
@@ -199,7 +199,10 @@ static void update_file(char *line)
 	if (dir)
 		printf("mkdir -p %.*s\n", (int)(dir - name), name);
 
-	printf("cvs -q -d %s checkout -r%s -p '%s/%s' > '%s'\n", cvsroot, version, cvsmodule, name, name);
+	printf("cvs -q -d %s checkout -d .git-tmp -r%s '%s/%s'\n", 
+		cvsroot, version, cvsmodule, name);
+	printf("mv -f .git-tmp/%s %s\n", dir ? dir+1 : name, name);
+	printf("rm -rf .git-tmp\n");
 	printf("git-update-cache --add -- '%s'\n", name);
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-18 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-18 20:52 cvs2git and file permissions Sven Verdoolaege
2005-06-18 21:23 ` Linus Torvalds
2005-06-18 22:31   ` Sven Verdoolaege

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).