Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[validate] Revert git_sha init in BaseContent #4778

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/4778.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Fixed an issue where the ***demisto-sdk validate*** command ran on the remote branch instead of the local current branch by default.
type: fix
pr_number: 4778
8 changes: 1 addition & 7 deletions demisto_sdk/commands/validate/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
PathLevel,
)
from demisto_sdk.commands.common.content import Content
from demisto_sdk.commands.common.git_util import GitUtil
from demisto_sdk.commands.common.logger import logger
from demisto_sdk.commands.common.tools import (
detect_file_level,
Expand Down Expand Up @@ -506,20 +505,15 @@ def git_paths_to_basecontent_set(
basecontent_with_path_set: Set[BaseContent] = set()
invalid_content_items: Set[Path] = set()
non_content_items: Set[Path] = set()
git_util = GitUtil.from_content_path()
current_git_sha = git_util.get_current_git_branch_or_hash()
for file_path, git_status in statuses_dict.items():
if git_status == GitStatuses.DELETED:
continue
try:
old_path = file_path
if isinstance(file_path, tuple):
file_path, old_path = file_path
obj = BaseContent.from_path(
file_path, git_sha=current_git_sha, raise_on_exception=True
)
obj = BaseContent.from_path(file_path, raise_on_exception=True)
if obj:
obj.git_sha = current_git_sha
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this part as well?
I thought we do want to keep some sort of a way to reach out to current git_sha

obj.git_status = git_status
# Check if the file exists
if (
Expand Down
Loading