1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-10 23:00:12 +02:00

Merge branch 'fix_gotorevisionx' into 'master'

Ignore git submodule failure in gotorevisionx

See merge request fdroid/fdroidserver!955
This commit is contained in:
Jochen Sprickerhof 2021-06-16 09:02:02 +00:00
commit 35cf7f289e
2 changed files with 44 additions and 0 deletions

View File

@ -1103,12 +1103,18 @@ class vcs_git(vcs):
# Discard any working tree changes
p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive',
'git', 'reset', '--hard'], cwd=self.local, output=False)
if p.returncode != 0:
logging.debug("Git submodule reset failed (ignored) {output}".format(output=p.output))
p = FDroidPopen(['git', 'reset', '--hard'], cwd=self.local, output=False)
if p.returncode != 0:
raise VCSException(_("Git reset failed"), p.output)
# Remove untracked files now, in case they're tracked in the target
# revision (it happens!)
p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive',
'git', 'clean', '-dffx'], cwd=self.local, output=False)
if p.returncode != 0:
logging.debug("Git submodule cleanup failed (ignored) {output}".format(output=p.output))
p = FDroidPopen(['git', 'clean', '-dffx'], cwd=self.local, output=False)
if p.returncode != 0:
raise VCSException(_("Git clean failed"), p.output)
if not self.refreshed:

View File

@ -1295,6 +1295,44 @@ else
echo "WARNING: wget not installed, skipping"
fi
#------------------------------------------------------------------------------#
echo_header "Test recovering from from broken git submodules"
if have_git_2_3; then
ROOT=$(create_test_dir)
cd "$ROOT"
mkdir foo bar
cd foo
git init
echo a > a
git add a
GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit -m "a" --author "Author <no@mail>"
cd ../bar
git init
git submodule add "file://$(pwd)/../foo" baz
rm .gitmodules
GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit -am "a" --author "Author <no@mail>"
rm -rf baz
git checkout baz
git tag 2
cd ..
mkdir repo
mkdir metadata
echo "RepoType: git" >> metadata/fake.yml
echo "Repo: file://$(pwd)/bar" >> metadata/fake.yml
echo "AutoUpdateMode: Version" >> metadata/fake.yml
echo "UpdateCheckMode: Tags" >> metadata/fake.yml
echo "UpdateCheckData: '|||'" >> metadata/fake.yml
echo "CurrentVersion: 1" >> metadata/fake.yml
echo "CurrentVersionCode: 1" >> metadata/fake.yml
$fdroid checkupdates --allow-dirty
grep "CurrentVersionCode: 2" metadata/fake.yml
fi
#------------------------------------------------------------------------------#
# remove this to prevent git conflicts and complaining