Skip to content

Commit

Permalink
root folder for tag preview under non-git
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthmalla authored Jan 9, 2025
1 parent 046095a commit 46e67c0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions python/extract_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_git_root():
git_root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], stderr=subprocess.DEVNULL)
return git_root.decode("utf-8").strip()
except subprocess.CalledProcessError:
return None
return "."
def extract_tag_details(tags_file, selected):
"""Extract tag details and retrieve content from the file."""
try:
Expand Down Expand Up @@ -53,8 +53,7 @@ def extract_tag_details(tags_file, selected):

# Use the Git root to resolve the full path
git_root = get_git_root()
if git_root is None:
return "Error: Not inside a Git repository."

file_path = os.path.join(git_root, relative_path)

# Check if the file exists
Expand Down Expand Up @@ -83,8 +82,6 @@ def extract_tag_details(tags_file, selected):
selected_entry = sys.argv[1]
# Get the Git root directory
git_root = get_git_root()
if git_root is None:
git_root = "."

# Path to the tags file in the Git root
tags_file_path = os.path.join(git_root, "tags")
Expand Down

0 comments on commit 46e67c0

Please sign in to comment.