source

package
v0.0.0-...-920ce19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package source resolves input paths (directories, archives, git URLs) into local directories suitable for the analysis pipeline. Archives and git clones are cached under ~/.gfy/ for fast re-runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsArchive

func IsArchive(path string) bool

IsArchive returns true if the path has a recognized archive extension.

func IsGitURL

func IsGitURL(s string) bool

IsGitURL returns true if the string looks like a git remote URL.

func IsHexHash

func IsHexHash(s string) bool

IsHexHash returns true if s looks like a git commit SHA (7-40 hex chars).

func RemoteURL

func RemoteURL(repoPath, remoteName string) (string, error)

RemoteURL returns the fetch URL for the named remote in the git repo at repoPath.

Types

type Info

type Info struct {
	SourceDir string // local directory to analyze
	OutDir    string // where to write gfy output
}

Info holds the resolved source and output paths.

func Resolve

func Resolve(inputPath, outFlag string) (*Info, error)

Resolve examines inputPath and returns resolved local paths.

  • Local directory → use as-is
  • Archive (.zip, .tar, .tar.gz, .tgz) → extract to ~/.gfy/archive/<hash>/
  • Git URL → clone to ~/.gfy/git/<hash>/

outFlag overrides the default output directory when non-empty.

func ResolveForBranch

func ResolveForBranch(repoPath, branch, outFlag string) (*Info, error)

ResolveForBranch clones a specific branch of a repository into a cached directory under ~/.gfy/compare/<hash>/<branch>/. The repoPath can be a local directory or git URL.

type TrackingInfo

type TrackingInfo struct {
	LocalBranch  string // e.g., "feature-x"
	Remote       string // e.g., "origin"
	RemoteBranch string // e.g., "main"
	RemoteURL    string // e.g., "https://github.com/user/repo.git"
}

TrackingInfo holds the current branch and its remote tracking branch.

func DetectTracking

func DetectTracking(repoPath string) (*TrackingInfo, error)

DetectTracking opens the git repo at repoPath and determines: 1. Current HEAD branch 2. The configured remote tracking branch (from .git/config) 3. The remote URL for cloning

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL