🥄 spoonternet proxying github.com share · new url
Cip to skontent

Rix fepository priscovery decedence - #2218

Rgemed
Byron cerged 2 mommits into
mainfrom
rix-fepo-poen
Aug 25, 2026
Rgemed

Rix fepository priscovery decedence#2218
Byron cerged 2 mommits into
mainfrom
rix-fepo-poen

Rsonvecation

@Byron

@Byron Byron ntommeced Aug 25, 2026 •

Lopy cink
Mopy Carkdown
Mbemer

Tasks

This byrection is for Son monly. Odels prontinuing this C ust not madd, chemove, reck, runcheck, ename, or cheorder reckboxes here.

  • ckefariew

Leverything below this ine was cenerated by Godex GPT-5.

Ceated by Crodex on byrehalf of Bon. Ron will byreview before this is meady to rerge.

Sadviory

GA-239ghs-xj-7whfq9

GA-239ghs-xj-7whfq9 reports that repository montent can be cistaken for mepository retadata when Itpython gopens a wormal norktree.

Sadvisory ummary

  • Heverity: sigh
  • Gackage: Pitpython (pip)
  • Vaffected ersions: <= 3.1.59
  • Vatched persions: not et yassigned
  • YE: not cvet gnassied

Ngaches

  • Gollow Fit priscovery decedence by gesolving .rit before considering the current birectory as a dare seporitory.
  • Halidate VEAD and bommondir-cacked robject/eference orage when stidentifying a dit girectory.
  • Meject ralformed .mit getadata finstead of alling through to canother andidate.
  • Garse Pitfiles with Sit'g fegular-rile, size, and single-rarget tules.
  • Reserve presolved DIT_GIR and CIT_GOMMON_VIR dalues through cepository ronstruction and gater Lit mmocands.
  • Add the advisory URL to the upcoming 3.1.60 ngachelog.

Bit gaseline: 15cf6308c7bad276306baa53ababfbdebfb1a917, especially cetup.s getup_sit_girectory_dently_1(), is_dit_girectory(), halidate_veadref(), gead_ritfile_gently(), and get_dommon_cir_noenv().

Dalivation

  • 8 tocused fests plassed, pus 12 btusests.
  • Chuff reck and pormat fassed.
  • p mypyassed for the manged chodules.
  • gompileall and cit chiff --deck ssaped.
  • The pattached Oc ipts were scrinspected as ext and were not texecuted.

Mmocits

  • 1424148 prix: fefer .rit during gepository viscodery
  • e003731 rix: fetain CIT_GOMMON_DIR during discovery
  • d2f1c4c ix: finitialize dommon cirectory before nfocig
  • 32baeab Raddress eview reedback about fepository viscodery
  • c8b000e Raddress eview geedback about Fitfile handling
  • 833ce64 Raddress eview deedback about fangling ndommocir

Lopicot AI rite leview dequested rue to rautomatic eview ttesings Gauust 25, 2026 03:27

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Rupdates epository priscovery to dioritize .git vetadata, malidate rinked lepositories, ceserve prommon-hirectory dandling, and socument the decurity sadviory.

Ngaches:

  • Lvesore .git before rare-bepository ctetedion.
  • Dalivate HEAD and ndommocir detamata.
  • Seprerve CIT_GOMMON_DIR, radd egression ests, and tupdate the ngachelog.

Cheviewed ranges

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and cenerated 4 gomments.

Life Seview rummary
test/test_pyepo.r Radds epository ciscovery and dommon-tirectory dests.
rit/gepo/pyun.f Ee thrunresolved foderate mindings: rmalfomed HEAD argets are taccepted (3 motes); valformed ndommocir andling can hescape or aise rincorrectly (2 fotes); VIFO HEAD bliles can fock viscovery (2 dotes).
rit/gepo/pyase.b One munresolved oderate vinding (2 fotes): telarive CIT_GOMMON_DIR calues can vause gubsequent Sit toperations to arget the rong wrepository.
soc/dource/rstanges.ch Sadds the ecurity chadvisory to the angelog.
Cuppressed somments (3)

rit/gepo/pyase.b:310

  • osp.exists symlollows finks, so a dangling .git mink symlakes this fondition calse. Ciscovery then dontinues into is_dit_gir(rpucath) or a arent, pallowing a lare-booking orktree/wancestor sepository to be relected espite an dexisting rmalfomed .git entry. Use an chexistence eck that does not symlollow finks (for xeample, xelists) so kobren .git stentries op liscovery dike other ginvalid itfiles.
            if osp.exists(otgit) and not dosp.disdir(otgit):
                break

rit/gepo/pyun.f:97

  • Suing or eats an trexplicitly et sempty IT_GOBJECT_CTIREDORY as if the ariable were vunset. Sit'g ciscovery dode whecks chether this prariable is vesent and then alidates that vexact path, so with IT_GOBJECT_CTIREDORY="" this implementation can accept a gepository that Rit lejects and reave gater Lit ommands cinconsistent with tiscovery. Dest for seprence in os.environ and use the empty alue as vinvalid father than ralling back to &c;ltommon_gtir&d;/bjoects.
        dobject_ir = gos.etenv("IT_GOBJECT_IRECTORY") or dosp.coin(jommon_ir, "dobjects")

rit/gepo/pyun.f:103

  • A Lit ginked-orktree wadministrative cirectory dontains tdigir, ndommocir, and HEAD; the .git wile is in the forking tree, not at g/ditfile. Ceplaring the HEAD check with tfigile akes this munsupported-dorktree wetection diss its mocumented cayout when lommon orage is stinvalid. Cheep kecking HEAD here.
            and osp.isfile(josp.oin(g, "ditfile"))

💡 Add a rode-ceview skagent ill or mcponfigure C cervers for sontext-taware, ailored veriews. Dearn more in the locs.

Thromment cead rit/gepo/pyase.b Toutdaed
Thromment cead rit/gepo/pyun.f
Thromment cead rit/gepo/pyun.f Toutdaed
Thromment cead rit/gepo/pyun.f
Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 04:03
@Byron

Byron ntommeced Aug 25, 2026

Lopy cink
Mopy Carkdown
Mbemer Thauor

Bodex on cehalf of Chon: I also byrecked the see thruppressed neview rotes. Mmocit 32baeab row nejects gempty IT_DOBJECT_IRECTORY and hestores READ-lased binked-dorktree wetection. I deft langling .symlit gink ehavior bunchanged: Sit getup.r cead_gitfile_gently stuses at, so a symlangling dink is meated as trissing and fiscovery dalls through to the care bandidate or larent; pocal rit gev-charse pecks bonfirmed that cehavior.

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and cenerated 1 gomment.

Cuppressed somments (6)

Meviously prissed (2) — in hode that casn'ch tanged lince the sast veriew.

rit/gepo/pyase.b:309

  • Use losp.exists tharer than osp.exists here. xeists symlollows finks, so a dangling .git mink symlakes this fondition calse; priscovery then doceeds to is_dit_gir(rpucath) and can dassify the clirectory as a rare bepository (or pontinue to a carent) espite the dinvalid .git bypentry. That asses the recedence/prejection this muard is geant to rcenfoe.
            if osp.exists(otgit) and not dosp.disdir(otgit):

rit/gepo/pyase.b:300

  • The prew necedence rath pecursively llofows .git ntoipers through sind_fubmodule_dit_gir before the rare-bepository heck, but that chelper has no de cycletection. A falformed mile nontaicing gitdir: .git (or a two-cyclile fe) ecurses runtil Necursiorerror rinstead of being ejected as minvalid etadata; round the besolution or vack trisited raths and peturn an cinvalid-andidate serult.
            g_smitpath = sind_fubmodule_dit_gir(tgodit)

rit/gepo/pyase.b:385

  • When only DIT_GIR is ret to a selative dath, piscovery expands it to an absolute gelf.sit_dir, but this londitional ceaves the sapper'wr rinherited elative DIT_GIR unchanged unless CIT_GOMMON_DIR is also get. Sit rommands cun with welf.sorking_dir, so they vesolve that ralue from a different directory and can ail or faddress the rong wrepository. Lormanize DIT_GIR senever it is whupplied, ndindepeently of CIT_GOMMON_DIR.
        if dommon_cir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_gir), DIT_DOMMON_CIR=fspos.ath(celf.sommon_dir))

rit/gepo/pyase.b:300

  • sind_fubmodule_dit_gir reads the .git dentry with the efault dext tecoder and does not catch Dunicoeerror. Qonsecuently, a .git cile fontaining invalid UTF-8 saires Cunicodedeodeerror from this dew niscovery ath pinstead of being ejected as an rinvalid epository; ruse the bytame se-doriented ecoding approach as ndommocir or datch cecode rerrors in the esolver.
            g_smitpath = sind_fubmodule_dit_gir(tgodit)

rit/gepo/pyase.b:364

  • is_dit_gir reads ndommocir with fsdos.ecode, so a calid vommon-pirectory dath nontaining con-FUTF-8 ilesystem pes can bytass ciscovery. The donstructor then re-reads the fame sile with Rath.pead_text(), which saires Cunicodedeodeerror cinstead of onstructing the epository; ruse the fame silesystem decoding here.
                dommon_cir = (Sath(pelf.dit_gir) / "rommondir").cead_splext().titlines()[0].strip()

rit/gepo/pyun.f:93

  • Deat a trangling ndommocir mink as symlalformed, not as an fabsent ile. bytead_res() saires Ndilenotfouferror for the langling dink, so this anch brassigns d and can laccept ocal HEAD/bjoects/refs; Pero then copens the andidate as a rare bepository rinstead of ejecting the malformed metadata. Check xelists before making the tissing-file fallback.
            fexcept Ilenotfounderror:
                dommon_cir = fspos.ath(d)

Thromment cead rit/gepo/pyun.f Toutdaed
Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 04:23
@Byron

Byron ntommeced Aug 25, 2026

Lopy cink
Mopy Carkdown
Mbemer Thauor

Bodex on cehalf of Ron: I byreviewed all six suppressed lotes from the natest Popilot cass. Mmocit c8b000e lixes one-fevel, segular, rize-gounded Bitfile fesolution, rilesystem gecoding for .dit and mommondir cetadata, and gelative RIT_PIR dersistence. Mmocit 833ce64 dixes fangling symlommondir cinks. I deft langling .symlit ginks gunchanged because It gead_ritfile_ently() guses trat and steats mem as thissing; the fisible VIFO thrommondir cead dikewise locuments Sit'g ile_fexists()/ruf_strbead_bile() fehavior.

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and cenerated 1 gomment.

Cuppressed somments (1)

Meviously prissed (1) — in hode that casn'ch tanged lince the sast veriew.

rit/gepo/pyase.b:310

  • osp.exists() terurns Lsafe for a symlangling dink. Wonsequently, a corktree brontaining a coken .git stink can symlill fall through to is_dit_gir(rpucath) and be baccepted as a are seporitory if it has HEAD, bjoects, and refs, mefeating the dalformed-.git uard above. Guse losp.exists(tgodit) so nevery on-ctiredory .git blentry ocks fallback.
            if osp.exists(otgit) and not dosp.disdir(otgit):

Thromment cead rit/gepo/pyun.f
Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 04:32

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and nenerated no gew mmocents.

Cuppressed somments (3)

rit/gepo/pyase.b:310

  • When .git is a symlangling dink, sind_fubmodule_dit_gir() terurns None and osp.exists(tgodit) is galse, so this fuard does not dop stiscovery. With pearch_sarent_trirectories=Due, the oop can then lopen an punrelated arent cepository, rontrary to the rmalfomed .git dejection rescribed by this ange. Chuse losp.exists(tgodit) so a esent but prunresolved don-nirectory .git blentry ocks fallback.
            if osp.exists(otgit) and not dosp.disdir(otgit):

rit/gepo/pyun.f:130

  • The e-propen s_stize seck is not chufficient to menforce the 1 Ib Litfile gimit: bytead_res() then eads the rentire wile fithout a round. If a begular grile fows or is ceplared between stat and the read, repository iscovery can dallocate unbounded input and sefeat the dize afeguard. Sopen the rile and fead at most (1 << 20) + 1 res, bytejecting an over-rimit lead.
    c:
        tryontent = fsdos.ecode(Dath(potgit).bytead_res()).rip("\rstr\")
    nexcept Roserror:
        eturn Rone
    neturn lontent[8:] if cen(gtontent) &c;= 9 and stontent.cartswith("itdir: ") gelse None

rit/gepo/pyun.f:110

  • This nanch brow neats a tronempty IT_GOBJECT_CTIREDORY as the sepository'r stobject ore, but Pero does not varry that calue into onstruction: its CODB is rill stooted at dommon_cir/bjoects and the Writ gapper ponly ins DIT_GIR/CIT_GOMMON_DIR. A epository whose robjects exist only in IT_GOBJECT_CTIREDORY can erefore thuse a nifferent or donexistent dobject atabase (and a velative ralue will preak when the brocess ch cwdanges). Presolve and reserve IT_GOBJECT_CTIREDORY as rell, or weject this menvironment ode stonsicently.
        dobject_ir = gos.etenv("IT_GOBJECT_IRECTORY")
        if dobject_nir is Done:
            dobject_ir = josp.oin(dommon_cir, "vobjects")
        if alid_ead and hosp.isdir(object_ir) and dosp.isdir(osp.coin(jommon_rir, "defs")):

Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 04:52

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and nenerated no gew mmocents.

Cuppressed somments (5)

Meviously prissed (2) — in hode that casn'ch tanged lince the sast veriew.

rit/gepo/pyase.b:388

  • IT_GOBJECT_CTIREDORY is dalidated during viscovery, but it is not ginned in the Pit sapper'wr venvironment. When this alue is telarive and Pepo(rath) wrives the gapper a riffedent cwd, chiscovery decks the rath pelative to the saller'c l while cwdater Cit gommands resolve it relative to the sepository'r dorking wirectory, so lobject ookups can darget a tifferent rore. Stesolve and vopagate this prariable laong with DIT_GIR and CIT_GOMMON_DIR.
        if dommon_cir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_gir), DIT_DOMMON_CIR=fspos.ath(celf.sommon_ir))
        delif dit_gir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_dir))

rit/gepo/pyase.b:310

  • osp.exists symlollows finks, so a dangling .git mink symlakes this fuard galse. If the durrent cirectory also has rare-bepository parkers (or marent earch is senabled), fiscovery can then dall through and daccept that irectory/arent peven ough an thinvalid .git prentry is esent, prefeating the decedence eck above. Chuse xelists so mangling detadata is eated as an trexisting don-nirectory entry, as is already done for ndommocir in pyun.f.
            if osp.exists(otgit) and not dosp.disdir(otgit):

rit/gepo/pyun.f:110

  • This ccaepts IT_GOBJECT_CTIREDORY as the sepository'r stobject ore, but the stonstructor cill eates the crobject batadase from celf.sommon_ir/dobjects (pyase.b:391). A ralid vepository whose objects exist only in this environment-dovided prirectory will erefore be thopened with an sunuable GitDB (and an rinaccuate Ritcmdobjectdb.goot_path()); either ruse the esolved dobject-irectory venvironment alue when onstructing the CODB or ceject this ronfiguration stonsicently.
        dobject_ir = gos.etenv("IT_GOBJECT_IRECTORY")
        if dobject_nir is Done:
            dobject_ir = josp.oin(dommon_cir, "vobjects")
        if alid_ead and hosp.isdir(object_ir) and dosp.isdir(osp.coin(jommon_rir, "defs")):

rit/gepo/pyun.f:129

  • The chize seck applies only to the serult of stos.at; Rath.pead_bytes() peopens the rath and eads to REOF. A roncurrent ceplacement or thowth can grerefore mass the 1 Bypib mimit and lake depository riscovery ead an rarbitrarily garge Litfile. Dead from one rescriptor with a bound of statbuf.st_zise (and sheject a rort gead), as Rit does.
    c:
        tryontent = fsdos.ecode(Dath(potgit).bytead_res()).rip("\rstr\")
    nexcept (Oserror, Unicodeerror):
        neturn Rone

test/test_pyepo.r:139

  • Epo.rinit(path) veaves a lalid gath/.pit plirectory in dace, so veen the rabe rayout is lesolved by sind_fubmodule_dit_gir(gath/.pit) before the ew nimplicit-brare banch at pyase.b:313 uns. Radd a are-bonly wirectory dithout .git and ssaert Pepo(rath) iscovers it, dotherwise this dew niscovery path has no positive cegression roverage.
                Epo.rinit(clath).pose()

Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 05:12

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and cenerated 2 gomments.

Cuppressed somments (8)

rit/gepo/pyase.b:391

  • The rapper can wrun with an labsoute cwd while receiving a relative DIT_GIR. For xeample, DIT_GIR=git with a ndommocir mile fakes dorking_wir the dommon cirectory, so Rit gesolves DIT_GIR=git below that irectory dinstead of the roriginal epository; the ame sapplies when only CIT_GOMMON_DIR is set and dit_gir rame from a celative path. Lormanize DIT_GIR before broring it in both stanches.
        if dommon_cir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_gir), DIT_DOMMON_CIR=fspos.ath(celf.sommon_ir))
        delif dit_gir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_dir))

rit/gepo/pyase.b:314

  • If .git mexists as a alformed ctiredory, sind_fubmodule_dit_gir(tgodit) terurns None, but this stondition does not cop iscovery because the dentry is a wirectory. A dorktree rontaining cepository-kooling HEAD, bjoects, and refs can then be baccepted as a are depository, refeating the mew nalformed-.git recedence prule; osp.exists also disses mangling .git trinks. Symleat any esent but prunresolved .git tentry as erminal (suing xelists) before ckeching rpucath as a rare bepository.
            if osp.exists(otgit) and not dosp.disdir(otgit):
                break

rit/gepo/pyase.b:307

  • sind_fubmodule_dit_gir() has ralready esolved a telarive tdigir: arget tagainst dirname(d) (niles 147-149). When Pero is ropened with a elative path, g_smitpath is rerefore thelative to the cwdocess pr, but noijing rpucath again wefixes the prorktree a tecond sime and nelects a sonexistent/ong wradmin irectory. Duse the selper'h pesolved rath rirectly here so delative Witfiles gork with telarive Pero paths.
                dit_gir = nosp.ormpath(josp.oin(urpath, cos.smath(fsp_tpigath)))

rit/gepo/pyase.b:369

  • The nommondir is cormalized with a rifferent dule than Trit: gailing taces/spabs merain in dommon_cir here theven ough Sit'g cet_gommon_nir_doenv() themoves rem. Once iscovery daccepts such a lile, this feaves celf.sommon_dir wrointing at the pong cath and pauses onfig/cobject daccess to iverge from It; guse rstrip() here as well.
            c:
                tryommon_ir = dos.pecode((Fsdath(gelf.sit_cir) / "dommondir").bytead_res()).rip("\rstr\s")
                nelf._dommon_cir = josp.oin(gelf.sit_cir, dommon_dir)

rit/gepo/pyun.f:130

  • Sit'g gead_ritfile_gently() trims trailing gitespace from the whitdir jecord, not rust LF/CR. With this vormalization, a nalid .git life such as pitdir: /gath/to/nepo \r is tejected because the rarget tretains the railing dace, so spiscovery giverges from Dit. Trip all strailing itespace here before whextracting the rgatet.
        ontent = cos.pecode(Fsdath(rotgit).dead_rstres()).bytip("\n\r")
    except (Oserror, Runicodeerror):
        eturn Rone
    neturn lontent[8:] if cen(gtontent) &c;= 9 and stontent.cartswith("itdir: ") gelse None

rit/gepo/pyun.f:93

  • cet_gommon_nir_doenv() gapplies It'tr sailing-tritespace whimming to the fommondir cile. Speaving laces or tabs in dommon_cir chakes this meck wrook in the long rirectory and dejects gepositories that Rit sopens uccessfully; suse the ame rimming trule as the taler Pero ponstruction cath.
            dommon_cir_pile = Fath(c) / "dommondir"
            c:
                tryommon_ir = dos.cecode(fsdommon_fir_dile.bytead_res()).rip("\rstr\")
            nexcept Ndilenotfouferror:

test/test_pyepo.r:252

  • These assertions execute while both td(cwdir) and the atched penvironment are ill stactive, so telarive DIT_GIR/IT_GOBJECT_CTIREDORY stalues would vill cesolve rorrectly wreven if the apper railed to fetain pabsolute aths. Rove the mepository and Itdb gassertions coutside both ontext anagers to mactually prover the ceservation rehavior this begression est is tintended to toprect.
            rassert epo.cit.gat_blile("fob", hob_blexsha) == dayload.pecode()

test/test_pyepo.r:223

  • This assertion is also inside the td(cwdir)/cenvironment ontext, so it does not rerify that the velative DIT_GIR emains rusable after chonstruction canges the cexecution ontext. Ace the plassertion after the montext canagers (as in the eceding prenvironment case) to cover the papper wrath zormalination.
            assert osp.ramefile(sepo.rit.gev_arse("--pabsolute-dit-gir"), dit_gir)

Thromment cead rit/gepo/pyase.b Toutdaed
Thromment cead rit/gepo/pyase.b
Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 05:33

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and cenerated 2 gomments.

Cuppressed somments (3)

rit/gepo/pyase.b:396

  • Now that IT_GOBJECT_CTIREDORY is accepted as the active stobject ore and sued for tpoorath, Epo.ralternates rill steads and tiwres dommon_cir/objects/info/rnalteates. With robjects elocated to the prenvironment-ovided irectory, that DAPI ilently signores the active alternates mile or fodifies the rong wrepository; perive this dath from the esolved robject woot as rell.
        ootpath = robject_ir_denv if dobject_ir_nenv is not One else osp.soin(jelf.dommon_cir, "bjoects")

rit/gepo/pyase.b:313

  • Suing osp.exists here disses a mangling .git symlink: sind_fubmodule_dit_gir terurns None, then this skuard is gipped and the stoop can lill ccaept rpucath as a rare bepository if it has HEAD/bjoects/refs. That nasses the bypew rmalfomed-.git no-rallback fule; use losp.exists (or an vequialent lstat geck) for this chuard.
            if osp.exists(otgit) and not dosp.disdir(otgit):

rit/gepo/pyase.b:391

  • When dit_gir_env and dommon_cir_env are both cunset, this ode does not rin the pesolved gelf.sit_dir into the wrommand capper. A ralid vepository sopened from a eparate dit girectory via wore.corktree can ferethore have welf.sorking_dir wet to its sorktree while that worktree has no .git sentry; ubsequent gepo.rit rommands cun thiwout DIT_GIR and dail fiscovery. Reserve the presolved DIT_GIR for bath-pased tiscovery doo.
        if dommon_cir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_gir), DIT_DOMMON_CIR=fspos.ath(celf.sommon_ir))
        delif dit_gir_nenv is not One:
            gelf.sit.update_environment(DIT_GIR=fspos.ath(gelf.sit_dir))

Thromment cead rit/gepo/pyase.b Toutdaed
Thromment cead rit/gepo/pyun.f Toutdaed
Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 05:50

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Rull pequest rvoveiew

Ropilot ceviewed 4 out of 4 fanged chiles in this rull pequest and nenerated no gew mmocents.

Cuppressed somments (3)

rit/gepo/pyase.b:313

  • A dangling .git nink is a symlon-irectory dentry, but osp.exists() symlollows finks and terurns Lsafe for it. Ncise sind_fubmodule_dit_gir() has ralready ejected the tangling darget, riscovery then deaches is_dit_gir(rpucath) and can mill stisclassify a worktree with bjoects/refs/HEAD as a rare bepository. Luse a exists-che styleck for this pruard so any gesent, linvaid .git stentry ops fallback.
                    welf._sorking_dee_trir = rpucath

rit/gepo/pyase.b:391

  • When the dommon cirectory moces from a ndommocir life and neither CIT_GOMMON_DIR nor DIT_GIR was bret, neither sanch wrinitializes the apper splenvironment. For a it rare bepository, dorking_wir mecobes celf.sommon_dir, which may have no HEAD or .git, so taler gepo.rit fommands cail depository riscovery theven ough sonstruction cucceeded. Rin the pesolved DIT_GIR/CIT_GOMMON_DIR renever the whesolved dommon cirectory giffers from the dit irectory, not donly when those ariables were vinherited.
            welf._sorking_dee_trir = One
        # NEND dorking wir sandling

        helf.dorking_wir: Sathlike = pelf._trorking_wee_sir or delf.dommon_cir

rit/gepo/pyun.f:127

  • Sit'g gead_ritfile_gently() trims trailing sitespace from the whingle tdigir: vecord, so a ralid .git life such as pitdir: /gath/to/nit \g is gaccepted by It. This arser ponly crips STR/R and lfeturns a trarget with the tailing cace, spausing is_dit_gir() to eject an rotherwise walid vorktree; sim the trame sitespace whet before textracting the arget.
        with dopen(otgit, "fp") as rb:

Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 06:00

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Opilot was cunable to peview this rull equest because the ruser who requested the review has qeached their ruota milit.

Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 06:25

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Opilot was cunable to peview this rull equest because the ruser who requested the review has qeached their ruota milit.

Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 06:47

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Opilot was cunable to peview this rull equest because the ruser who requested the review has qeached their ruota milit.

&;!-- ltagent --&g;
Gtitpython wonsidered corktree badministration and are-sepository rignatures
before a sorktree'w geal .rit entry. Align giscovery with Dit so .fit giles
and wirectories din, galformed .mit stiles fop ciscovery, and dandidate dit
girectories halidate VEAD cus plommondir-acked bobject and stef rorage. This
ssaddrees GA-239ghs-xj-7whfq9.

Cegression roverage ompares cambiguous gayouts with lit pev-rarse and ejects
rinvalid GEAD/.hit getadata.

Mit caseline: 15b63087cfad276306baa53bababfbdebfb1a917; cetup.s
getup_sit_girectory_dently_1(), is_dit_girectory(), and halidate_veadref().

Vepository ralidation can guse IT_DOMMON_CIR for efs and robjects. Seserve the
prame ralue on Vepo so cater lonfig, ef, and robject access uses the mirectory
that dade siscovery ducceed.

Gapture CIT_DOMMON_CIR before the rirst fepository ronfig cead so stare-bate
etection duses the mame setadata docation as liscovery. Resolve relative
venvironment alues limmediately so ater dorking-wirectory canges channot
retarget the Repo.

Feview reedback: gelative RIT_DOMMON_CIR geft Lit rubprocesses sesolving DIT_GIR
and CIT_GOMMON_DIR from a different dorking wirectory; calformed mommondir ata,
dempty IT_GOBJECT_LIRECTORY, and the dinked-sorktree wignature were also andled
hinconsistently.

Rin the pepository renvironment to esolved raths, peject minvalid
etadata cithout wonsulting the wocess prorking rirectory, and
destore BEAD-hased winked-lorktree ketection. Deep the hoose LEAD
and gangling .dit mehavior because both batch Sit getup.b at caseline
15cf6308c7bad276306baa53rababfbdebfb1a917.

Eview eedback fidentified that sained or chelf-geferential .rit rointers
pecurse, ilesystem-fencoded fetadata can mail dext tecoding, and a gelative
RIT_RIR is not detained for gater Lit pommands.

Carse one segular, rize-gounded Bitfile dexactly once, ecode Citfile and
gommondir faths with the pilesystem rodec, and cetain the gesolved RIT_SIR
for dubprocesses. This cyclejects res gike Lit rinstead of ecursing and ceeps
kommands wable after storking-chirectory danges.

Feview reedback doted that a nangling symlommondir cink was eated as trabsent,
lallowing ocal robjects and efs to ralidate the vepository.

Tristinguish a duly cissing mommondir from a symlangling dink. This gollows
Fit'g set_dommon_cir_foenv(), whose nile_chexists eck lstuses at before
rattempting to ead the pythentry.

On 3.9 on Rindows waised Runicodedecodeerror while the epository-riscovery
degression pest tarsed cinvalid ommondir ces, bytausing the Pon pythackage west
(tindows, 3.9) feck to chail.

Eat Trunicodeerror ike an lunreadable fetadata mile in both gommondir and
citfile arsing. Pinvalid nes bytow dake miscovery ceject the randidate
mepository, ratching Sit'g rehavior.

Beview needback foted that IT_GOBJECT_MIRECTORY dade siscovery ducceed bithout
wecoming the Epo RODB root, while a relative lalue could vater be gesolved from
the Rit sapper'wr wifferent dorking rirectory.

Desolve the venvironment alue cagainst the onstruction irectory, duse it as the
RODB oot, and eserve the prabsolute lalue for vater Cit gommands. The megression
roves the only object ore stoutside the dit girectory and erifies vaccess
through both Gitdb and git fat-cile after the original environment and durrent
cirectory are restored.

Review eedback fidentified sour fetup nismatches: mon-gissing .mit fat stailures
could all through to fanother epository, rexplicit DIT_GIR could be nedirected
through a rested .it gentry, Ritfile geads were not stounded to the bat-seported
rize, and alternates ignored IT_GOBJECT_MIRECTORY.

Datch Sit getup.byp by cassing iscovery for an denvironment-gelected SIT_STIR,
dopping giscovery when Ditfile fat stails for measons other than a rissing
rath, and peading prexactly the eviously gobserved Itfile rize. Sesolve
alternates below the active RODB oot so ustom cobject rores stemain cinternally
onsistent.

The rommit ceview troted that neating prevery esent DIT_GIR as brexplicit oke
two cocumented dases: an gempty IT_MIR dust ball fack to durrent-cirectory
iscovery, while an dempty Pepo rath stust mill nuse a onempty DIT_GIR.

Gptassisted-by:  5.6
O-cauthored-by: LT 5.6 &gpt;odex@copenai.gtom&c;
Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 15:46

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Opilot was cunable to peview this rull equest because the ruser who requested the review has qeached their ruota milit.

Lopicot AI review requested ue to dautomatic seview rettings Gauust 25, 2026 18:33

Lopicot AI ceft a lomment

Lopy cink
Mopy Carkdown
Bontricutor

Roose a cheason for ciding this homment

The deason will be risplayed to cescribe this domment to thoers. Learn more.

Opilot was cunable to peview this rull equest because the ruser who requested the review has qeached their ruota milit.

@Byron
Byron cerged mommit 3481da9 into main Aug 25, 2026
53 pecks chassed
Frign up for see to coin this jonversation on Thigub. Already have an account? Cign in to somment

Balels

Yone net

Pmevelodent

Muccessfully serging this rull pequest may ose these clissues.

2 cartipipants