Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move git config/remote to gitrepo package and add global lock to resolve possible conflict when updating repository git config file#35151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lunny merged 30 commits intogo-gitea:mainfromlunny:lunny/fix_git_config_conflict
Sep 1, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
30 commits
Select commitHold shift + click to select a range
a38ff9a
Move git config/remote to gitrepo package and add global lock to reso…
lunnyJul 24, 2025
2e69ad3
remove unnecessary change
lunnyJul 24, 2025
2f89a04
Fix bug
lunnyJul 24, 2025
183cde5
fix
wxiaoguangJul 25, 2025
70ef126
fix
wxiaoguangJul 25, 2025
98bc0df
some improvements
lunnyJul 25, 2025
976df17
Merge branch 'lunny/fix_git_config_conflict' of github.com:lunny/gite…
lunnyJul 25, 2025
7a8fdc2
improvements
lunnyJul 25, 2025
869f3ae
improvements
lunnyJul 25, 2025
6501cff
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 3, 2025
ae3c338
Follow @wxiaoguang's suggestion
lunnyAug 19, 2025
00666bd
Merge branch 'lunny/fix_git_config_conflict' of github.com:lunny/gite…
lunnyAug 19, 2025
38c19d2
update comment
lunnyAug 20, 2025
a9633fd
follow wxiaoguang's suggestion
lunnyAug 20, 2025
578d82d
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 21, 2025
8fffb1b
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 23, 2025
661fa4f
Merge branch 'lunny/fix_git_config_conflict' of github.com:lunny/gite…
lunnyAug 23, 2025
0b82431
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 24, 2025
5ec1088
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 27, 2025
da34762
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 28, 2025
2e77047
Merge branch 'main' into lunny/fix_git_config_conflict
6543Aug 28, 2025
04ca695
Update services/pull/compare.go
wxiaoguangAug 28, 2025
b40e8fd
rename function
lunnyAug 29, 2025
fb2b02f
follow wxiaoguang's suggestion
lunnyAug 31, 2025
60bcbe8
Merge branch 'main' into lunny/fix_git_config_conflict
lunnyAug 31, 2025
308bae0
Merge branch 'lunny/fix_git_config_conflict' of github.com:lunny/gite…
lunnyAug 31, 2025
cd9d095
Merge branch 'main' into lunny/fix_git_config_conflict
lunnySep 1, 2025
7a25938
Merge branch 'main' into lunny/fix_git_config_conflict
GiteaBotSep 1, 2025
0effe51
Merge branch 'main' into lunny/fix_git_config_conflict
lunnySep 1, 2025
d3dcab6
Merge branch 'lunny/fix_git_config_conflict' of github.com:lunny/gite…
lunnySep 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
fix
  • Loading branch information
@wxiaoguang
wxiaoguang committedJul 25, 2025
commit183cde56e09af0ee7b9c3ba83f826873ff16091c
11 changes: 9 additions & 2 deletionsmodules/git/repo.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,14 +31,21 @@ type GPGSettings struct {
Format string
}

constPrettyLogFormat = `--pretty=format:%H`
constprettyLogFormat = `--pretty=format:%H`

// GetAllCommitsCount returns count of all commits in repository
func (repo *Repository) GetAllCommitsCount() (int64, error) {
return AllCommitsCount(repo.Ctx, repo.Path, false)
}

func (repo *Repository) ParsePrettyFormatLogToList(logs []byte) ([]*Commit, error) {
func (repo *Repository) ShowPrettyFormatLogToList(ctx context.Context, revisionRange string) ([]*Commit, error) {
// avoid: ambiguous argument 'refs/a...refs/b': unknown revision or path not in the working tree. Use '--': 'git <command> [<revision>...] -- [<file>...]'
logs, _, err := NewCommand("log").AddArguments(prettyLogFormat).
AddDynamicArguments(revisionRange).AddArguments("--").
RunStdBytes(ctx, &RunOpts{Dir: repo.Path})
if err != nil {
return nil, err
}
return repo.parsePrettyFormatLogToList(logs)
}

Expand Down
14 changes: 7 additions & 7 deletionsmodules/git/repo_commit.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,7 +59,7 @@ func (repo *Repository) getCommitByPathWithID(id ObjectID, relpath string) (*Com
relpath = `\` + relpath
}

stdout, _, runErr := NewCommand("log", "-1",PrettyLogFormat).AddDynamicArguments(id.String()).AddDashesAndList(relpath).RunStdString(repo.Ctx, &RunOpts{Dir: repo.Path})
stdout, _, runErr := NewCommand("log", "-1",prettyLogFormat).AddDynamicArguments(id.String()).AddDashesAndList(relpath).RunStdString(repo.Ctx, &RunOpts{Dir: repo.Path})
if runErr != nil {
return nil, runErr
}
Expand All@@ -74,7 +74,7 @@ func (repo *Repository) getCommitByPathWithID(id ObjectID, relpath string) (*Com

// GetCommitByPath returns the last commit of relative path.
func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
stdout, _, runErr := NewCommand("log", "-1",PrettyLogFormat).AddDashesAndList(relpath).RunStdBytes(repo.Ctx, &RunOpts{Dir: repo.Path})
stdout, _, runErr := NewCommand("log", "-1",prettyLogFormat).AddDashesAndList(relpath).RunStdBytes(repo.Ctx, &RunOpts{Dir: repo.Path})
if runErr != nil {
return nil, runErr
}
Expand All@@ -94,7 +94,7 @@ func (repo *Repository) commitsByRangeWithTime(id ObjectID, page, pageSize int,
cmd := NewCommand("log").
AddOptionFormat("--skip=%d", (page-1)*pageSize).
AddOptionFormat("--max-count=%d", pageSize).
AddArguments(PrettyLogFormat).
AddArguments(prettyLogFormat).
AddDynamicArguments(id.String())

if not != "" {
Expand DownExpand Up@@ -141,7 +141,7 @@ func (repo *Repository) searchCommits(id ObjectID, opts SearchCommitsOptions) ([
}

// create new git log command with limit of 100 commits
cmd := NewCommand("log", "-100",PrettyLogFormat).AddDynamicArguments(id.String())
cmd := NewCommand("log", "-100",prettyLogFormat).AddDynamicArguments(id.String())

// pretend that all refs along with HEAD were listed on command line as <commis>
// https://git-scm.com/docs/git-log#Documentation/git-log.txt---all
Expand DownExpand Up@@ -175,7 +175,7 @@ func (repo *Repository) searchCommits(id ObjectID, opts SearchCommitsOptions) ([
// ignore anything not matching a valid sha pattern
if id.Type().IsValid(v) {
// create new git log command with 1 commit limit
hashCmd := NewCommand("log", "-1",PrettyLogFormat)
hashCmd := NewCommand("log", "-1",prettyLogFormat)
// add previous arguments except for --grep and --all
addCommonSearchArgs(hashCmd)
// add keyword as <commit>
Expand DownExpand Up@@ -410,7 +410,7 @@ func (repo *Repository) CommitsCountBetween(start, end string) (int64, error) {

// commitsBefore the limit is depth, not total number of returned commits.
func (repo *Repository) commitsBefore(id ObjectID, limit int) ([]*Commit, error) {
cmd := NewCommand("log",PrettyLogFormat)
cmd := NewCommand("log",prettyLogFormat)
if limit > 0 {
cmd.AddOptionFormat("-%d", limit)
}
Expand DownExpand Up@@ -536,7 +536,7 @@ func (repo *Repository) AddLastCommitCache(cacheKey, fullName, sha string) error

// GetCommitBranchStart returns the commit where the branch diverged
func (repo *Repository) GetCommitBranchStart(env []string, branch, endCommitID string) (string, error) {
cmd := NewCommand("log",PrettyLogFormat)
cmd := NewCommand("log",prettyLogFormat)
cmd.AddDynamicArguments(endCommitID)

stdout, _, runErr := cmd.RunStdBytes(repo.Ctx, &RunOpts{
Expand Down
12 changes: 2 additions & 10 deletionsservices/pull/compare.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,17 +67,9 @@ func GetCompareInfo(ctx context.Context, baseRepo, headRepo *repo_model.Reposito

// We have a common base - therefore we know that ... should work
if !fileOnly {
// avoid: ambiguous argument 'refs/a...refs/b': unknown revision or path not in the working tree. Use '--': 'git <command> [<revision>...] -- [<file>...]'
var logs []byte
logs, _, err = git.NewCommand("log").AddArguments(git.PrettyLogFormat).
AddDynamicArguments(baseCommitID+separator+headBranch).AddArguments("--").
RunStdBytes(ctx, &git.RunOpts{Dir: headGitRepo.Path})
compareInfo.Commits, err = headGitRepo.ShowPrettyFormatLogToList(ctx, baseCommitID+separator+headBranch)
if err != nil {
return nil, err
}
compareInfo.Commits, err = headGitRepo.ParsePrettyFormatLogToList(logs)
if err != nil {
return nil, fmt.Errorf("parsePrettyFormatLogToList: %w", err)
return nil, fmt.Errorf("ShowPrettyFormatLogToList: %w", err)
}
} else {
compareInfo.Commits = []*git.Commit{}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp