fix import-bundle: chown bare repo to root before gitimport, restore clean gitimport for url-based import

Anton Kaminsky28d ago416062b11a22parent e02f2d4
1 file changed+27-11
api/src/routes/repos.ts
@@ -717,10 +717,19 @@
717717 await runDocker([
718718 "run", "--rm",
719719 "-v", "/data/grove:/data/grove",
720 "--entrypoint", "sh",
720 "--entrypoint", "gitimport",
721721 "grove/mononoke:latest",
722 "-c",
723 `git config --global --add safe.directory '*' && gitimport --repo-name ${repoName} --config-path ${MONONOKE_CONFIG_PATH} --local-configerator-path ${DATA_DIR}/configerator --cache-mode disabled --just-knobs-config-path ${DATA_DIR}/justknobs.json --generate-bookmarks --derive-hg --git-command-path /usr/bin/git --concurrency 5 ${bareRepo} full-repo`,
722 "--repo-name", repoName,
723 "--config-path", MONONOKE_CONFIG_PATH,
724 "--local-configerator-path", `${DATA_DIR}/configerator`,
725 "--cache-mode", "disabled",
726 "--just-knobs-config-path", `${DATA_DIR}/justknobs.json`,
727 "--generate-bookmarks",
728 "--derive-hg",
729 "--git-command-path", "/usr/bin/git",
730 "--concurrency", "5",
731 bareRepo,
732 "full-repo",
724733 ], (line) => {
725734 send("log", { step: "import", line });
726735 });
@@ -814,12 +823,10 @@
814823 await runDocker([
815824 "run", "--rm",
816825 "-v", "/data/grove:/data/grove",
817 "--entrypoint", "mv",
826 "--entrypoint", "sh",
818827 "grove/mononoke:latest",
819 `${DATA_DIR}/bare.git`, bareRepo,
820 ], () => {}).catch(() => {
821 // Already at the right path
822 });
828 "-c", `mv ${DATA_DIR}/bare.git ${bareRepo} 2>/dev/null; chown -R root:root ${bareRepo}`,
829 ], () => {});
823830
824831 send("progress", { step: "upload", message: "Extracted." });
825832
@@ -829,10 +836,19 @@
829836 await runDocker([
830837 "run", "--rm",
831838 "-v", "/data/grove:/data/grove",
832 "--entrypoint", "sh",
839 "--entrypoint", "gitimport",
833840 "grove/mononoke:latest",
834 "-c",
835 `git config --global --add safe.directory '*' && gitimport --repo-name ${repoName} --config-path ${MONONOKE_CONFIG_PATH} --local-configerator-path ${DATA_DIR}/configerator --cache-mode disabled --just-knobs-config-path ${DATA_DIR}/justknobs.json --generate-bookmarks --derive-hg --git-command-path /usr/bin/git --concurrency 5 ${bareRepo} full-repo`,
841 "--repo-name", repoName,
842 "--config-path", MONONOKE_CONFIG_PATH,
843 "--local-configerator-path", `${DATA_DIR}/configerator`,
844 "--cache-mode", "disabled",
845 "--just-knobs-config-path", `${DATA_DIR}/justknobs.json`,
846 "--generate-bookmarks",
847 "--derive-hg",
848 "--git-command-path", "/usr/bin/git",
849 "--concurrency", "5",
850 bareRepo,
851 "full-repo",
836852 ], (line) => {
837853 send("log", { step: "import", line });
838854 });
839855