{"thread":{"id":"970","subject":"cvs2git and file permissions","startedAt":"2005-06-18T20:52:08Z","lastAt":"2005-06-18T22:31:15Z","messageCount":3,"participants":["Sven Verdoolaege","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"5019","messageId":"20050618205208.GA4917@billie.cs.kuleuven.ac.be","threadId":"970","inReplyTo":null,"subject":"cvs2git and file permissions","fromName":"Sven Verdoolaege","fromEmail":"sven.verdoolaege@cs.kuleuven.ac.be","sentAt":"2005-06-18T20:52:08Z","receivedAt":"2005-06-18T20:52:08Z","isPatch":false,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"cvs2git currently drops mode information.\nI've been bitten by this behaviour twice already.\nThe patch below fixes that, though not very cleanly.\n\nskimo\n--\ngit-cvs2git: propagate mode information\n\nLet cvs checkout in a temporary directory rather than\nusing the pipe option to avoid loss of mode information.\n\nSigned-off-by: Sven Verdoolaege <skimo@liacs.nl>\n\n---\ncommit df97fd9b709bd927f15adbc1a90ddfcfa79c7895\ntree 0f223f52fdf7d61d7d1df0da1137a542811d27f9\nparent fdf95bf8d4d1182db579bd25fe5e25811084eaa6\nauthor Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 22:41:46 +0200\ncommitter Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 22:41:46 +0200\n\n cvs2git.c |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/cvs2git.c b/cvs2git.c\n--- a/cvs2git.c\n+++ b/cvs2git.c\n@@ -196,10 +196,15 @@ static void update_file(char *line)\n \t}\n \n \tdir = strrchr(name, '/');\n-\tif (dir)\n+\tif (dir) {\n \t\tprintf(\"mkdir -p %.*s\\n\", (int)(dir - name), name);\n+\t\tprintf(\"mkdir -p .git-tmp/%.*s\\n\", (int)(dir - name), name);\n+\t}\n \n-\tprintf(\"cvs -q -d %s checkout -r%s -p '%s/%s' > '%s'\\n\", cvsroot, version, cvsmodule, name, name);\n+\tprintf(\"cvs -q -d %s checkout -N -d .git-tmp -r%s '%s/%s'\\n\", \n+\t\tcvsroot, version, cvsmodule, name);\n+\tprintf(\"mv -f .git-tmp/%s/%s %s\\n\", cvsmodule, name, name);\n+\tprintf(\"rm -rf .git-tmp\\n\");\n \tprintf(\"git-update-cache --add -- '%s'\\n\", name);\n }\n \n"},{"id":"5020","messageId":"Pine.LNX.4.58.0506181421070.2268@ppc970.osdl.org","threadId":"970","inReplyTo":"20050618205208.GA4917@billie.cs.kuleuven.ac.be","subject":"Re: cvs2git and file permissions","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-18T21:23:48Z","receivedAt":"2005-06-18T21:23:48Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 18 Jun 2005, Sven Verdoolaege wrote:\n> \n> Let cvs checkout in a temporary directory rather than\n> using the pipe option to avoid loss of mode information.\n\nHmm.. Why do you use the \"-N\" flag?\n\nWouldn't it be much cleaner to _not_ create all those sub-directories \nunder \".git-tmp\", and instead do something like\n\n\t\"cvs -q -d %s checkout -d .git-tmp -r%s '%s/%s'\" ...\n\t\"mv -f .git-tmp/%s %s\\n\", dir ? dir+1 : name, name\n\nWith that changed (and tested ;), I'll happily take it.\n\n\t\tLinus\n"},{"id":"5023","messageId":"20050618223115.GA5505@billie.cs.kuleuven.ac.be","threadId":"970","inReplyTo":"Pine.LNX.4.58.0506181421070.2268@ppc970.osdl.org","subject":"Re: cvs2git and file permissions","fromName":"Sven Verdoolaege","fromEmail":"sven.verdoolaege@cs.kuleuven.ac.be","sentAt":"2005-06-18T22:31:15Z","receivedAt":"2005-06-18T22:31:15Z","isPatch":false,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Sat, Jun 18, 2005 at 02:23:48PM -0700, Linus Torvalds wrote:\n> On Sat, 18 Jun 2005, Sven Verdoolaege wrote:\n> > \n> > Let cvs checkout in a temporary directory rather than\n> > using the pipe option to avoid loss of mode information.\n> \n> Hmm.. Why do you use the \"-N\" flag?\n\nI didn't quite know how to interpret the \"as short as possible\" in\n\n              Use the -d dir option to create a directory  called\n              dir  for  the  working  files, instead of using the\n              module name.  Unless you also  use  -N,  the  paths\n              created under dir will be as short as possible.\n\nIt would appear you do.\n\n> Wouldn't it be much cleaner to _not_ create all those sub-directories \n> under \".git-tmp\", and instead do something like\n> \n> \t\"cvs -q -d %s checkout -d .git-tmp -r%s '%s/%s'\" ...\n> \t\"mv -f .git-tmp/%s %s\\n\", dir ? dir+1 : name, name\n> \n> With that changed (and tested ;), I'll happily take it.\n\nSeems to work.\n\nThe rm is still needed though.  Without it, cvs can get confused.\n\nskimo\n--\ngit-cvs2git: propagate mode information\n\nLet cvs checkout in a temporary directory rather than\nusing the pipe option to avoid loss of mode information.\n\nSigned-off-by: Sven Verdoolaege <skimo@liacs.nl>\n\n---\ncommit 188ea2ee70413147fc1b80fedc3fbee02843e590\ntree f122fcf591013aff299a4d072eed47255892d3a1\nparent fdf95bf8d4d1182db579bd25fe5e25811084eaa6\nauthor Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 23:55:49 +0200\ncommitter Sven Verdoolaege <skimo@kotnet.org> Sat, 18 Jun 2005 23:55:49 +0200\n\n cvs2git.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/cvs2git.c b/cvs2git.c\n--- a/cvs2git.c\n+++ b/cvs2git.c\n@@ -199,7 +199,10 @@ static void update_file(char *line)\n \tif (dir)\n \t\tprintf(\"mkdir -p %.*s\\n\", (int)(dir - name), name);\n \n-\tprintf(\"cvs -q -d %s checkout -r%s -p '%s/%s' > '%s'\\n\", cvsroot, version, cvsmodule, name, name);\n+\tprintf(\"cvs -q -d %s checkout -d .git-tmp -r%s '%s/%s'\\n\", \n+\t\tcvsroot, version, cvsmodule, name);\n+\tprintf(\"mv -f .git-tmp/%s %s\\n\", dir ? dir+1 : name, name);\n+\tprintf(\"rm -rf .git-tmp\\n\");\n \tprintf(\"git-update-cache --add -- '%s'\\n\", name);\n }\n \n"}]}