diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2023-08-31 08:30:32 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-02 11:48:05 +0100 |
commit | d51176429de50ef0f136b0c936797c87f244125b (patch) | |
tree | 6f786a94ad46b138425b227091ec547eb985766e | |
parent | 81af7cd4065acf092b9b9d10f52f1895025d85bb (diff) | |
download | poky-d51176429de50ef0f136b0c936797c87f244125b.tar.gz |
bitbake: fetch2: git: Remove useless try..else clause
There is no reason to have the else clause in this try block, as it can
be moved into the try block, which is clearer.
(Bitbake rev: 5625849e9327fc71a38eea00d4506f80abc11bc6)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 33895e09b2..e11271b757 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -373,10 +373,7 @@ class Git(FetchMethod): | |||
373 | try: | 373 | try: |
374 | # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel | 374 | # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel |
375 | output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir) | 375 | output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir) |
376 | except bb.fetch2.FetchError as e: | 376 | |
377 | logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e) | ||
378 | needs_clone = True | ||
379 | else: | ||
380 | toplevel = os.path.abspath(output.rstrip()) | 377 | toplevel = os.path.abspath(output.rstrip()) |
381 | abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/') | 378 | abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/') |
382 | # The top level Git directory must either be the clone directory | 379 | # The top level Git directory must either be the clone directory |
@@ -387,6 +384,9 @@ class Git(FetchMethod): | |||
387 | if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir: | 384 | if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir: |
388 | logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir) | 385 | logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir) |
389 | needs_clone = True | 386 | needs_clone = True |
387 | except bb.fetch2.FetchError as e: | ||
388 | logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e) | ||
389 | needs_clone = True | ||
390 | 390 | ||
391 | if needs_clone: | 391 | if needs_clone: |
392 | shutil.rmtree(ud.clonedir) | 392 | shutil.rmtree(ud.clonedir) |