Rewrite package-submodule-blacklist to python, make it work on both client and server#7
Open
dmach wants to merge 1 commit into
Open
Rewrite package-submodule-blacklist to python, make it work on both client and server#7dmach wants to merge 1 commit into
dmach wants to merge 1 commit into
Conversation
eliroca
requested changes
Jun 2, 2026
eliroca
left a comment
Member
There was a problem hiding this comment.
In my testing we're missing the case when there is no _manifest file.
diff --git a/src/all-hooks/package-submodule-blacklist b/src/all-hooks/package-submodule-blacklist
index f153b74..a548809 100755
--- a/src/all-hooks/package-submodule-blacklist
+++ b/src/all-hooks/package-submodule-blacklist
@@ -7,8 +7,8 @@ import sys
if os.environ.get("PACKAGE_SUBMODULE_BLACKLIST_SKIP", None):
sys.exit(0)
-from osc.git_scm import GitStore
-from osc.gitea_api import Git
+from osc.git_scm.store import GitStore
+from osc.gitea_api.git import Git
BLACKLIST_FILE = ".git-workflow/hooks/package-submodule-blacklist.txt"
@@ -25,7 +25,10 @@ def check_revision(rev: str) -> bool:
store = GitStore(".", ref=rev, check=False)
git = store._git
- if git.is_bare:
+ if store.manifest is None:
+ directories = git.ls_tree(rev)
+ package_paths = [i["path"] for i in directories if i["file_type"] in ("directory", "submodule")]
+ elif git.is_bare:
directories = git.ls_tree(rev)
directories = [i["path"] for i in directories if i["file_type"] in ("directory", "submodule")]
package_paths = store.manifest.get_package_paths_bare_git(store.topdir, directories=directories)
@@ -99,7 +102,7 @@ def main():
for old_rev, new_rev in rev_list:
# we want to enable 'not_all' only in the pre-receive hook
- commits = git.get_commit_range(old_rev, new_rev, not_all=is_pre_receive)
+ commits = git.get_commit_range(old_rev, new_rev, not_all=bool(is_pre_receive))
for sha in commits:
if sha in seen:
continue3bc9846 to
d931005
Compare
Collaborator
Author
|
Could you give it another try? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.