From 47648d637ff57350fb51ebd64589177da5d42150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=82=8E=E6=B3=BC?= Date: Sat, 12 Feb 2022 22:13:30 +0800 Subject: [PATCH] fix: when using "--repo .@xx" and xx has no remote configured, use the first found remote for pushing assets --- README-cn.md | 2 +- README.md | 2 +- md2zhihu/__init__.py | 6 +++++- requirements.txt | 2 +- test.sh | 4 ++-- version.py | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README-cn.md b/README-cn.md index 2f78972..d161619 100644 --- a/README-cn.md +++ b/README-cn.md @@ -88,7 +88,7 @@ md2zhihu 不支持windows, 可以通过github-action来实现远程转换: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: drmingdrmer/md2zhihu@v0.13 + - uses: drmingdrmer/md2zhihu@v0.14 env: GITHUB_USERNAME: ${{ github.repository_owner }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index b10d4e3..9734c0a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: drmingdrmer/md2zhihu@v0.13 + - uses: drmingdrmer/md2zhihu@v0.14 env: GITHUB_USERNAME: ${{ github.repository_owner }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/md2zhihu/__init__.py b/md2zhihu/__init__.py index 239ecda..eb81831 100644 --- a/md2zhihu/__init__.py +++ b/md2zhihu/__init__.py @@ -860,7 +860,11 @@ def get_remote_url(self, remote=None): if remote is None: branch = g.head_branch(flag='x') - remote = g.branch_default_remote(branch, flag='x') + remote = g.branch_default_remote(branch, flag='n') + if remote is None: + # `branch` has no remote configured. + remote = g.cmdf("remote", flag="xo")[0] + remote_url = g.remote_get(remote, flag='x') return remote_url diff --git a/requirements.txt b/requirements.txt index e7b2260..02ddc6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ PyYAML>=5.3.1 k3color>=0.1.2 -k3down2>=0.1.15 +k3down2>=0.1.16 k3fs>=0.1.5 k3git>=0.1.6 k3handy>=0.1.5 diff --git a/test.sh b/test.sh index 0938d47..f8695dc 100755 --- a/test.sh +++ b/test.sh @@ -8,5 +8,5 @@ cd .. python setup.py install ) -PYTHONPATH="$(cd ..; pwd)" pytest -x -v -# PYTHONPATH="$(cd ..; pwd)" pytest -x -v -k test_zhihu_download +# PYTHONPATH="$(cd ..; pwd)" pytest -x -v +PYTHONPATH="$(cd ..; pwd)" pytest -x -v -k test_zhihu_download diff --git a/version.py b/version.py index 40f279d..ef82bdc 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ -__version__ = "0.13" +__version__ = "0.14" __name__ = "md2zhihu"