Skip to content

feat: Add get_repo_remote_url() function to git_utils.py #1230

Closed

Description

@nightfury-devai

Is there an existing issue for this?

I have searched the existing issues and found none.

Problem Statement

The file src/codegraphcontext/utils/git_utils.py currently has two helper functions:

get_repo_commit_hash() - returns the HEAD commit SHA
get_repo_branch_name() - returns the active branch name

However there is no get_repo_remote_url() function to get the remote origin URL. This is inconsistent since remote URL is equally useful git metadata for enriching repository records.

Proposed Solution

Add a get_repo_remote_url() function following the exact same pattern as the existing functions:

def get_repo_remote_url(repo_path: Path) -> Optional[str]:
try:
url = subprocess.check_output(
["git", "remote", "get-url", "origin"],
cwd=repo_path,
stderr=subprocess.DEVNULL,
).decode().strip()
return url if url else None
except (subprocess.CalledProcessError, FileNotFoundError, OSError):
return None

Benefits

Completes the git helper functions set consistently
Allows repository records to be enriched with remote URL metadata
Follows the exact same silent error handling pattern already established

Record

I agree to follow this project's Code of Conduct
I want to work on this issue

Activity

  1. github-actions commented on Jun 13, 2026

    @github-actions
    Contributor

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

  2. prerendrarahitya1708 commented on Jun 15, 2026

    @prerendrarahitya1708

    Hi, I am a GSSoC 2026 contributor and would like to work on this issue. Can I get it assigned to me?

  3. madsysharma commented on Jun 16, 2026

    @madsysharma

    /assign
    I would like to work on this as part of GSSoC 2026.

  4. moved this from Backlog tasks to In progress in CGC Progress Boardon Jul 29, 2026
  5. added
    gssoc:approvedGSSoC validation: counts toward scoring
    level:beginnerGSSoC difficulty: 20 pts contributor / 10 mentor
    mentor:Shashankss1205GSSoC mentor attribution: credits reviewing mentor
    type:featureGSSoC type bonus: feature
    on Sep 24, 2026
  6. Shashankss1205 commented on Oct 15, 2026

    @Shashankss1205
    Collaborator

    Maintenance review — 15 October 2026

    Implemented #1767: get_repo_remote_url() reads local origin configuration without contacting the network and returns None on missing git/origin/errors. Real temporary-repository and failure cases are covered.

  7. moved this from In progress to Done in CGC Progress Boardon Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

gssoc:approvedGSSoC validation: counts toward scoringlevel:beginnerGSSoC difficulty: 20 pts contributor / 10 mentormentor:Shashankss1205GSSoC mentor attribution: credits reviewing mentortype:featureGSSoC type bonus: feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions