Skip to content

Commit

Permalink
Remove unused parseMergeResult
Browse files Browse the repository at this point in the history
  • Loading branch information
niik committed Nov 27, 2024
1 parent 09037ec commit fb15151
Show file tree
Hide file tree
Showing 209 changed files with 2 additions and 703,745 deletions.
68 changes: 2 additions & 66 deletions app/src/lib/git/merge-tree.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,9 @@
import byline from 'byline'
import { Branch } from '../../models/branch'
import { ComputedAction } from '../../models/computed-action'
import { MergeTreeResult } from '../../models/merge'
import { Repository } from '../../models/repository'
import { git, GitError } from './core'
import { GitError as DugiteError } from 'dugite'

// the merge-tree output is a collection of entries like this
//
// changed in both
// base 100644 f69fbc5c40409a1db7a3f8353bfffe46a21d6054 atom/browser/resources/mac/Info.plist
// our 100644 9094f0f7335edf833d51f688851e6a105de60433 atom/browser/resources/mac/Info.plist
// their 100644 2dd8bc646cff3869557549a39477e30022e6cfdd atom/browser/resources/mac/Info.plist
// @@ -17,9 +17,15 @@
// <key>CFBundleIconFile</key>
// <string>electron.icns</string>
// <key>CFBundleVersion</key>
// +<<<<<<< .our
// <string>4.0.0</string>
// <key>CFBundleShortVersionString</key>
// <string>4.0.0</string>
// +=======
// + <string>1.4.16</string>
// + <key>CFBundleShortVersionString</key>
// + <string>1.4.16</string>
// +>>>>>>> .their
// <key>LSApplicationCategoryType</key>
//<string>public.app-category.developer-tools</string>
// <key>LSMinimumSystemVersion</key>

// The first line for each entry is what I'm referring to as the the header
// This regex filters on the known entries that can appear
const contextHeaderRe =
/^(merged|added in remote|removed in remote|changed in both|removed in local|added in both)$/

const conflictMarkerRe = /^\+[<>=]{7}$/
import { git, isGitError } from './core'
import { GitError } from 'dugite'

export async function determineMergeability(
repository: Repository,
Expand Down Expand Up @@ -69,37 +38,4 @@ export async function determineMergeability(
? Promise.resolve({ kind: ComputedAction.Invalid })
: Promise.reject(e)
)


export function parseMergeTreeResult(stream: NodeJS.ReadableStream) {
return new Promise<MergeTreeResult>(resolve => {
let seenConflictMarker = false
let conflictedFiles = 0

stream
.pipe(byline())
.on('data', (line: string) => {
// New header means new file, reset conflict flag and record if we've
// seen a conflict in this file or not
if (contextHeaderRe.test(line)) {
if (seenConflictMarker) {
conflictedFiles++
seenConflictMarker = false
}
} else if (!seenConflictMarker && conflictMarkerRe.test(line)) {
seenConflictMarker = true
}
})
.on('end', () => {
if (seenConflictMarker) {
conflictedFiles++
}

resolve(
conflictedFiles > 0
? { kind: ComputedAction.Conflicts, conflictedFiles }
: { kind: ComputedAction.Clean }
)
})
})
}

This file was deleted.

Loading

0 comments on commit fb15151

Please sign in to comment.