mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
81af7cd406
commit
d51176429d
@@ -373,10 +373,7 @@ class Git(FetchMethod):
|
||||
try:
|
||||
# Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
|
||||
output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
|
||||
except bb.fetch2.FetchError as e:
|
||||
logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
|
||||
needs_clone = True
|
||||
else:
|
||||
|
||||
toplevel = os.path.abspath(output.rstrip())
|
||||
abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
|
||||
# The top level Git directory must either be the clone directory
|
||||
@@ -387,6 +384,9 @@ class Git(FetchMethod):
|
||||
if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
|
||||
logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
|
||||
needs_clone = True
|
||||
except bb.fetch2.FetchError as e:
|
||||
logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
|
||||
needs_clone = True
|
||||
|
||||
if needs_clone:
|
||||
shutil.rmtree(ud.clonedir)
|
||||
|
||||
Reference in New Issue
Block a user