MCPcopy
hub / github.com/git-lfs/git-lfs / mergeDriverCommand

Function mergeDriverCommand

commands/command_merge_driver.go:24–47  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

22)
23
24func mergeDriverCommand(cmd *cobra.Command, args []string) {
25 if len(mergeDriverAncestor) == 0 || len(mergeDriverCurrent) == 0 || len(mergeDriverOther) == 0 || len(mergeDriverOutput) == 0 {
26 Exit(tr.Tr.Get("the --ancestor, --current, --other, and --output options are mandatory"))
27 }
28
29 fileSpecifiers := make(map[string]string)
30 gf := lfs.NewGitFilter(cfg)
31 mergeProcessInput(gf, mergeDriverAncestor, fileSpecifiers, "O")
32 mergeProcessInput(gf, mergeDriverCurrent, fileSpecifiers, "A")
33 mergeProcessInput(gf, mergeDriverOther, fileSpecifiers, "B")
34 mergeProcessInput(gf, "", fileSpecifiers, "D")
35
36 fileSpecifiers["L"] = fmt.Sprintf("%d", mergeDriverMarkerSize)
37
38 if len(mergeDriverProgram) == 0 {
39 mergeDriverProgram = "git merge-file --stdout --marker-size=%L %A %O %B >%D"
40 }
41
42 status, err := processFiles(fileSpecifiers, mergeDriverProgram, mergeDriverOutput)
43 if err != nil {
44 ExitWithError(err)
45 }
46 os.Exit(status)
47}
48
49func processFiles(fileSpecifiers map[string]string, program string, outputFile string) (int, error) {
50 defer mergeCleanup(fileSpecifiers)

Callers

nothing calls this directly

Calls 6

NewGitFilterFunction · 0.92
ExitFunction · 0.85
mergeProcessInputFunction · 0.85
processFilesFunction · 0.85
ExitWithErrorFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected