GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - waigani/diffparser: A Golang package for parsing git diffs

BranchesTags
Open more actions menu

Latest commit

 

History

22 Commits
22 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
Gopkg.lock
Gopkg.lock
 
 
Gopkg.toml
Gopkg.toml
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
diffparser.go
diffparser.go
 
 
diffparser_test.go
diffparser_test.go
 
 
example.diff
example.diff
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 

Repository files navigation

DiffParser

GoDoc

DiffParser is a Golang package which parse's a git diff.

Install

go get github.com/waigani/diffparser

Usage Example

package main

import (
	"fmt"
	"github.com/waigani/diffparser"
)

// error handling left out for brevity
func main() {
	byt, _ := ioutil.ReadFile("example.diff")
	diff, _ := diffparser.Parse(string(byt))

	// You now have a slice of files from the diff,
	file := diff.Files[0]

	// diff hunks in the file,
	hunk := file.Hunks[0]

	// new and old ranges in the hunk
	newRange := hunk.NewRange

	// and lines in the ranges.
	line := newRange.Lines[0]
}

More Examples

See diffparser_test.go for further examples.

About

A Golang package for parsing git diffs

Resources

Readme
MIT license
Activity

Stars

55 stars

Watchers

4 watching

Forks

34 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.