Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: git log ( Fixes #334 ) #335

Merged
merged 4 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## ugit 0.4.5.1:

> Like It? [Star It](https://github.com/StartAutomating/ugit)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)

* `git log` fix duplicate commit issue ( #334 )
* Thanks @ninmonkey !

---

## ugit 0.4.5:

> Like It? [Star It](https://github.com/StartAutomating/ugit)
Expand Down
19 changes: 10 additions & 9 deletions Extensions/Git.Log.UGit.Extension.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
param(
)

begin {
begin {
$script:LogChangesMerged = $false
$Git_Log = [Regex]::new(@'
(?m)^commit # Commits start with 'commit'
Expand All @@ -66,7 +66,7 @@ begin {

$lines = [Collections.Generic.List[string]]::new()
$StartsWithCommit = [Regex]::new('^commit', 'IgnoreCase')
$gitLogTypeName =
$gitLogTypeName =
if ($gitCommand -match '--merges') {
'git.merge.log'
} else {
Expand All @@ -79,7 +79,7 @@ begin {
$gitLogMatch = $Git_Log.Match($OutputLines -join [Environment]::NewLine)
if (-not $gitLogMatch.Success) { return }

$gitLogOut = [Ordered]@{PSTypeName=$gitLogTypeName;GitCommand=$gitCommand}
$gitLogOut = [Ordered]@{PSTypeName=$gitLogTypeName;GitCommand=$gitCommand}
foreach ($group in $gitLogMatch.Groups) {
if ($group.Name -as [int] -ne $null) { continue }
if (-not $gitLogOut.Contains($group.Name)) {
Expand All @@ -91,7 +91,7 @@ begin {
$gitLogOut.Remove("HexDigits")
if ($gitLogOut.CommitDate) {
$gitLogOut.CommitDateString = $gitLogOut.CommitDate
$gitLogOut.Remove("CommitDate")
$gitLogOut.Remove("CommitDate")
}
if ($gitLogOut.CommitMessage) {
$gitLogOut.CommitMessage = $gitLogOut.CommitMessage.Trim()
Expand All @@ -115,7 +115,7 @@ begin {
if ($gitLogOut.CommitMessage -match 'into (?<Branch>.+)$') {
$gitLogOut.Destination = $matches.Branch
}
}
}

if ($GitArgument -contains '--shortstat' -or $GitArgument -contains '--stat') {
foreach ($linePart in $OutputLines[-2] -split ',' -replace '[\s\w\(\)-[\d]]') {
Expand All @@ -140,7 +140,7 @@ begin {
if (-not $gitLogOut.Insertions) {
$gitLogOut.Insertions = 0
}
}
}

$gitLogOut.GitOutputLines = $OutputLines
$gitLogOut.Merged = $script:LogChangesMerged
Expand All @@ -166,8 +166,9 @@ end {
$commitStartLine = $lineIndex
}
}

OutGitLog $allInput[$commitStartIndex..($allInput.Count - 1)]

if ( $commitStartLine -lt $allInput.Count ) {
OutGitLog $allInput[$commitStartLine..($allInput.Count - 1)]
}
$ExecutionContext.SessionState.PSVariable.Remove('script:LogChangesMerged')
}

10 changes: 10 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## ugit 0.4.5.1:

> Like It? [Star It](https://github.com/StartAutomating/ugit)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)

* `git log` fix duplicate commit issue ( #334 )
* Thanks @ninmonkey !

---

## ugit 0.4.5:

> Like It? [Star It](https://github.com/StartAutomating/ugit)
Expand Down
55 changes: 6 additions & 49 deletions ugit.psd1
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@{
ModuleVersion = '0.4.5'
ModuleVersion = '0.4.5.1'
RootModule = 'ugit.psm1'
FormatsToProcess = 'ugit.format.ps1xml'
TypesToProcess = 'ugit.types.ps1xml'
Guid = '32323806-1d4a-485b-a64b-c502b0468847'
Author = 'James Brundage'
Copyright = '2022-2024 Start-Automating'
Copyright = '2022-2024 Start-Automating'
CompanyName = 'Start-Automating'
Description = 'ugit: git, updated with PowerShell'
PrivateData = @{
Expand All @@ -15,56 +15,13 @@ PrivateData = @{
LicenseURI = 'https://github.com/StartAutomating/ugit/blob/main/LICENSE'
BuildModule = @('EZOut', 'Piecemeal', 'PipeScript', 'PSSVG')
ReleaseNotes = @'
## ugit 0.4.5:
## ugit 0.4.5.1:

> Like It? [Star It](https://github.com/StartAutomating/ugit)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)

* git improvements
* `git clone`
* git clone -Since improvements (#276)
* git clone -Since time period (#277)
* `git log`
* git.log.Trailer (#305)
* git.log.Description (#304)
* git.log.Scope (#303)
* git.log.CommitType (#301)
* git.log.CommitDate (#309)
* git.log.Change(s) (#306)
* git.log.note(s) (#296)
* git log accumulation improvement (#308)
* git log parsing improvement (#306,#308,#309)
* git.log.JiraTicket(s) (#313)
* git log -TicketNumber(s) (#315)
* `git commit`
* git commit -OnBehalfOf (#275)
* git commit -CoAuthoredBy (#274)
* git commit -SkipCI (#320)
* Container improvements
* Container.init.ps1 (#279,#280)
* Container.start.ps1 (#281)
* Container.stop.ps1 (#282)
* Action improvements
* Refactoring ugit action (#289,#290)
* Testing action in branch (#288)
* New Parameters:
* `ActionScript` (#311)
* `GitHubToken` (#317)
* `NoCommit` (#318)
* `NoPush` (#319)
* `TargetBranch` (#316)
* Workflow improvements
* Fixing ugit workflow PublishTestResults (#287)
* GitPub cleanup (#310)
* New Examples:
* ChangesByCommitType example (#302, #301)
* ChangesByDayOfWeek example (#295)
* ChangesByIssueNumber example (#294)
* ChangesByUserName example (#293)
* ChangesByExtension example (#292)
* ReleaseNotes Example (#307)
* TableOfCurrentBranch example (#291)

* `git log` fix duplicate commit issue ( #334 )
* Thanks @ninmonkey !
---

Additional Changes in [Changelog](https://github.com/StartAutomating/ugit/blob/main/CHANGELOG.md)
Expand All @@ -80,4 +37,4 @@ Additional Changes in [Changelog](https://github.com/StartAutomating/ugit/blob/m
)
}
}
}
}