Fix all unit tests without git.Init after #19732 merged, clean code for git < 2.0 after #19577 #9022

Closed
opened 2025-11-02 08:26:14 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @wxiaoguang on GitHub (Jun 2, 2022).

At the moment, PR #19732 doesn't ensure all unit tests call git.Init correctly.

// at the moment, we just use a temp HomeDir to prevent from conflicting with user's git config
// in future, the git module should be initialized first before use.
HomeDir = filepath.Join(os.TempDir(), "/gitea-temp-home")
log.Warn("Git's HomeDir is empty, the git module is not initialized correctly, using a temp HomeDir (%s) temporarily", HomeDir) 

This issue is here to remind that these unit tests should be fixed after #19732 gets merged.

And one more thing, since Gitea 1.17 has dropped Git<2.0 (#19577), some code might be cleaned, too.

Originally created by @wxiaoguang on GitHub (Jun 2, 2022). At the moment, PR #19732 doesn't ensure all unit tests call git.Init correctly. ```go // at the moment, we just use a temp HomeDir to prevent from conflicting with user's git config // in future, the git module should be initialized first before use. HomeDir = filepath.Join(os.TempDir(), "/gitea-temp-home") log.Warn("Git's HomeDir is empty, the git module is not initialized correctly, using a temp HomeDir (%s) temporarily", HomeDir) ``` This issue is here to remind that these unit tests should be fixed after #19732 gets merged. And one more thing, since Gitea 1.17 has dropped Git<2.0 (#19577), some code might be cleaned, too.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9022