rename hawser => git-lfs

This commit is contained in:
Rick Olson 2015-03-19 13:30:55 -06:00
parent 550e2a9e1e
commit e37b695477
114 changed files with 425 additions and 443 deletions

2
.gitignore vendored

@ -2,7 +2,7 @@ bin/
benchmark/
.vendor/pkg
servertest
.vendor/src/github.com/hawser/git-hawser
.vendor/src/github.com/github/git-lfs
# only allow man/*.\d.ronn files
man/*

@ -1,4 +1,4 @@
## Contributing to Git Hawser
## Contributing to Git Large File Storage
Hi there! We're thrilled that you'd like to contribute to this project. Your
help is essential for keeping it great.
@ -27,7 +27,7 @@ them as separate pull requests.
0. Update `Godeps`.
0. Run `script/vendor` to update the code in the `.vendor/src` directory.
0. Commit the change. Hawser vendors the full source code in the repository.
0. Commit the change. Git LFS vendors the full source code in the repository.
0. Submit a pull request.
## Resources
@ -36,6 +36,6 @@ them as separate pull requests.
- [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
- [GitHub Help](https://help.github.com)
[fork]: https://github.com/hawser/git-hawser/fork
[pr]: https://github.com/hawser/git-hawser/compare
[fork]: https://github.com/github/git-lfs/fork
[pr]: https://github.com/github/git-lfs/compare
[style]: https://github.com/golang/go/wiki/CodeReviewComments

@ -1,50 +1,50 @@
Git Hawser
Git Large File Storage
======
Git command line extension for managing large files. Hawser replaces large
files with text pointers inside Git, while storing the actual files in a remote
Hawser server.
Git LFS is a command line extension for managing large files. It replaces
large files with text pointers inside Git, while storing the actual files in a
remote Git LFS server.
The Git Hawser client is written in Go, with pre-compiled binaries available for
The Git LFS client is written in Go, with pre-compiled binaries available for
Mac, Windows, Linux, and FreeBSD.
See [CONTRIBUTING.md](CONTRIBUTING.md) for info on working on Hawser and sending
patches.
See [CONTRIBUTING.md](CONTRIBUTING.md) for info on working on Git LFS and
sending patches.
## Getting Started
Download the [latest client][rel] and run the included install script. The
installer should run `git hawser init` for you, which sets up Git's global
configuration settings for Hawser.
installer should run `git lfs init` for you, which sets up Git's global
configuration settings for Git LFS.
[rel]: https://github.com/hawser/git-hawser/releases
[rel]: https://github.com/github/git-lfs/releases
### Configuration
Hawser uses `.gitattributes` files to configure which are managed by Hawser.
Git LFS uses `.gitattributes` files to configure which are managed by Git LFS.
Here is a sample one that saves zips and mp3s:
$ cat .gitattributes
*.mp3 filter=hawser -crlf
*.zip filter=hawser -crlf
*.mp3 filter=lfs -crlf
*.zip filter=lfs -crlf
Hawser can help manage the paths:
Git LFS can help manage the paths:
$ git hawser add "*.mp3"
$ git lfs add "*.mp3"
Adding path *.mp3
$ git hawser add "*.zip"
$ git lfs add "*.zip"
Adding path *.zip
$ git hawser path
$ git lfs path
Listing paths
*.mp3 (.gitattributes)
*.zip (.gitattributes)
$ git hawser remove "*.zip"
$ git lfs remove "*.zip"
Removing path *.zip
$ git hawser path
$ git lfs path
Listing paths
*.mp3 (.gitattributes)
@ -55,9 +55,9 @@ Once setup, you're ready to push some commits.
$ git add my.zip
$ git commit -m "add zip"
You can confirm that Hawser is managing your zip file:
You can confirm that Git LFS is managing your zip file:
$ git hawser ls-files
$ git lfs ls-files
my.zip
Once you've made your commits, push your files to the Git remote.
@ -70,7 +70,7 @@ Once you've made your commits, push your files to the Git remote.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 548 bytes | 0 bytes/s, done.
Total 5 (delta 1), reused 0 (delta 0)
To https://github.com/hawser/hawser-test
To https://github.com/github/git-lfs-test
67fcf6a..47b2002 master -> master
See the [Hawser overview](https://github.com/hawser/git-hawser/tree/master/docs) and [man pages](https://github.com/hawser/git-hawser/tree/master/docs/man).
See the [Git LFS overview](https://github.com/github/git-lfs/tree/master/docs) and [man pages](https://github.com/github/git-lfs/tree/master/docs/man).

@ -1,7 +1,7 @@
package main
import (
"github.com/hawser/git-hawser/commands"
"github.com/github/git-lfs/commands"
)
func main() {

@ -19,7 +19,7 @@ func TestClean(t *testing.T) {
cmd := repo.Command("clean", "somefile")
cmd.Input = bytes.NewBufferString(content)
cmd.Output = `version https://hawser.github.com/spec/v1
cmd.Output = `version https://git-lfs.github.com/spec/v1
oid sha256:` + oid + `
size 3`
@ -32,7 +32,7 @@ size 3`
cmd = repo.Command("clean")
cmd.Input = bytes.NewBufferString(content)
cmd.Output = `version https://hawser.github.com/spec/v1
cmd.Output = `version https://git-lfs.github.com/spec/v1
oid sha256:` + oid + `
size 3`
customHook := []byte("echo 'yo'")

@ -2,7 +2,7 @@ package commands
import (
"fmt"
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
"io"
"os"
@ -18,10 +18,10 @@ var (
)
func addCommand(cmd *cobra.Command, args []string) {
hawser.InstallHooks(false)
lfs.InstallHooks(false)
if len(args) < 1 {
Print("git hawser path add <path> [path]*")
Print("git lfs path add <path> [path]*")
return
}
@ -52,7 +52,7 @@ func addCommand(cmd *cobra.Command, args []string) {
continue
}
_, err := attributesFile.WriteString(fmt.Sprintf("%s filter=hawser -crlf\n", t))
_, err := attributesFile.WriteString(fmt.Sprintf("%s filter=lfs -crlf\n", t))
if err != nil {
Print("Error adding path %s", t)
continue

@ -1,8 +1,8 @@
package commands
import (
"github.com/hawser/git-hawser/hawser"
"github.com/hawser/git-hawser/pointer"
"github.com/github/git-lfs/lfs"
"github.com/github/git-lfs/pointer"
"github.com/spf13/cobra"
"os"
)
@ -16,10 +16,10 @@ var (
)
func cleanCommand(cmd *cobra.Command, args []string) {
hawser.InstallHooks(false)
lfs.InstallHooks(false)
var filename string
var cb hawser.CopyCallback
var cb lfs.CopyCallback
var file *os.File
var fileSize int64
if len(args) > 0 {
@ -29,7 +29,7 @@ func cleanCommand(cmd *cobra.Command, args []string) {
if err == nil && stat != nil {
fileSize = stat.Size()
localCb, localFile, err := hawser.CopyCallbackFile("clean", filename, 1, 1)
localCb, localFile, err := lfs.CopyCallbackFile("clean", filename, 1, 1)
if err != nil {
Error(err.Error())
} else {
@ -51,7 +51,7 @@ func cleanCommand(cmd *cobra.Command, args []string) {
}
tmpfile := cleaned.File.Name()
mediafile, err := hawser.LocalMediaPath(cleaned.Oid)
mediafile, err := lfs.LocalMediaPath(cleaned.Oid)
if err != nil {
Panic(err, "Unable to get local media path.")
}

@ -1,7 +1,7 @@
package commands
import (
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
)
@ -14,7 +14,7 @@ var (
)
func envCommand(cmd *cobra.Command, args []string) {
config := hawser.Config
config := lfs.Config
if endpoint := config.Endpoint(); len(endpoint) > 0 {
Print("Endpoint=%s", endpoint)
@ -24,7 +24,7 @@ func envCommand(cmd *cobra.Command, args []string) {
Print("Endpoint (%s)=%s", remote, config.RemoteEndpoint(remote))
}
for _, env := range hawser.Environ() {
for _, env := range lfs.Environ() {
Print(env)
}
}

@ -1,7 +1,7 @@
package commands
import (
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
)
@ -20,19 +20,19 @@ var (
)
func initCommand(cmd *cobra.Command, args []string) {
if err := hawser.InstallFilters(); err != nil {
if err := lfs.InstallFilters(); err != nil {
Error(err.Error())
}
if hawser.InRepo() {
if lfs.InRepo() {
initHooksCommand(cmd, args)
}
Print("git hawser initialized")
Print("git lfs initialized")
}
func initHooksCommand(cmd *cobra.Command, args []string) {
if err := hawser.InstallHooks(false); err != nil {
if err := lfs.InstallHooks(false); err != nil {
Error(err.Error())
}
}

@ -2,7 +2,7 @@ package commands
import (
"errors"
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
"io/ioutil"
"os"
@ -64,7 +64,7 @@ func logsShowCommand(cmd *cobra.Command, args []string) {
}
name := args[0]
by, err := ioutil.ReadFile(filepath.Join(hawser.LocalLogDir, name))
by, err := ioutil.ReadFile(filepath.Join(lfs.LocalLogDir, name))
if err != nil {
Exit("Error reading log: %s", name)
}
@ -74,23 +74,23 @@ func logsShowCommand(cmd *cobra.Command, args []string) {
}
func logsClearCommand(cmd *cobra.Command, args []string) {
err := os.RemoveAll(hawser.LocalLogDir)
err := os.RemoveAll(lfs.LocalLogDir)
if err != nil {
Panic(err, "Error clearing %s", hawser.LocalLogDir)
Panic(err, "Error clearing %s", lfs.LocalLogDir)
}
Print("Cleared %s", hawser.LocalLogDir)
Print("Cleared %s", lfs.LocalLogDir)
}
func logsBoomtownCommand(cmd *cobra.Command, args []string) {
Debug("Debug message")
err := hawser.Errorf(errors.New("Inner error message!"), "Error!")
err := lfs.Errorf(errors.New("Inner error message!"), "Error!")
Panic(err, "Welcome to Boomtown")
Debug("Never seen")
}
func sortedLogs() []string {
fileinfos, err := ioutil.ReadDir(hawser.LocalLogDir)
fileinfos, err := ioutil.ReadDir(lfs.LocalLogDir)
if err != nil {
return []string{}
}

@ -1,15 +1,15 @@
package commands
import (
"github.com/hawser/git-hawser/git"
"github.com/hawser/git-hawser/scanner"
"github.com/github/git-lfs/git"
"github.com/github/git-lfs/scanner"
"github.com/spf13/cobra"
)
var (
lsFilesCmd = &cobra.Command{
Use: "ls-files",
Short: "Show information about hawser files",
Short: "Show information about Git LFS files",
Run: lsFilesCommand,
}
)
@ -29,7 +29,7 @@ func lsFilesCommand(cmd *cobra.Command, args []string) {
pointers, err := scanner.Scan(ref, "")
if err != nil {
Panic(err, "Could not scan for hawser files")
Panic(err, "Could not scan for Git LFS files")
}
for _, p := range pointers {

@ -2,7 +2,7 @@ package commands
import (
"bufio"
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
"os"
"path/filepath"
@ -18,7 +18,7 @@ var (
)
func pathCommand(cmd *cobra.Command, args []string) {
hawser.InstallHooks(false)
lfs.InstallHooks(false)
Print("Listing paths")
knownPaths := findPaths()
@ -35,12 +35,12 @@ type mediaPath struct {
func findAttributeFiles() []string {
paths := make([]string, 0)
repoAttributes := filepath.Join(hawser.LocalGitDir, "info", "attributes")
repoAttributes := filepath.Join(lfs.LocalGitDir, "info", "attributes")
if _, err := os.Stat(repoAttributes); err == nil {
paths = append(paths, repoAttributes)
}
filepath.Walk(hawser.LocalWorkingDir, func(path string, info os.FileInfo, err error) error {
filepath.Walk(lfs.LocalWorkingDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
@ -71,7 +71,7 @@ func findPaths() []mediaPath {
continue
}
if strings.Contains(line, "filter=hawser") {
if strings.Contains(line, "filter=lfs") {
fields := strings.Fields(line)
relPath, _ := filepath.Rel(wd, path)
paths = append(paths, mediaPath{Path: fields[0], Source: relPath})

@ -2,10 +2,10 @@ package commands
import (
"fmt"
"github.com/hawser/git-hawser/git"
"github.com/hawser/git-hawser/hawser"
"github.com/hawser/git-hawser/pointer"
"github.com/hawser/git-hawser/scanner"
"github.com/github/git-lfs/git"
"github.com/github/git-lfs/lfs"
"github.com/github/git-lfs/pointer"
"github.com/github/git-lfs/scanner"
"github.com/rubyist/tracerx"
"github.com/spf13/cobra"
"io/ioutil"
@ -17,7 +17,7 @@ import (
var (
pushCmd = &cobra.Command{
Use: "push",
Short: "Push files to the hawser endpoint",
Short: "Push files to the Git LFS endpoint",
Run: pushCommand,
}
dryRun = false
@ -25,7 +25,7 @@ var (
deleteBranch = "(delete)"
)
// pushCommand is the command that's run via `git hawser push`. It has two modes
// pushCommand is the command that's run via `git lfs push`. It has two modes
// of operation. The primary mode is run via the git pre-push hook. The pre-push
// hook passes two arguments on the command line:
// 1. Name of the remote to which the push is being done
@ -38,20 +38,15 @@ var (
// by using the following:
// git rev-list --objects <local sha1> ^<remote sha1>
//
// If any of those git objects are associated with hawser objects, those hawser
// objects will be pushed to the hawser endpoint.
// If any of those git objects are associated with Git LFS objects, those
// objects will be pushed to the Git LFS API.
//
// In the case of pushing a new branch, the list of git objects will be all of
// the git objects in this branch.
//
// In the case of deleting a branch, no attempts to push hawser objects will be
// In the case of deleting a branch, no attempts to push Git LFS objects will be
// made.
//
// When pushing hawser objects, the client will first perform an OPTIONS command
// which will determine not only whether or not the client is authorized, but also
// whether or not that hawser endpoint already has the hawser object. If it
// does, the object will not be pushed.
//
// The other mode of operation is the dry run mode. In this mode, the repo
// and refspec are passed on the command line. pushCommand will calculate the
// git objects that would be pushed in a similar manner as above and will print
@ -60,11 +55,11 @@ func pushCommand(cmd *cobra.Command, args []string) {
var left, right string
if len(args) == 0 {
Print("The git hawser pre-push hook is out of date. Please run `git hawser update`")
Print("The git lfs pre-push hook is out of date. Please run `git lfs update`")
os.Exit(1)
}
hawser.Config.CurrentRemote = args[0]
lfs.Config.CurrentRemote = args[0]
if useStdin {
refsData, err := ioutil.ReadAll(os.Stdin)
@ -84,7 +79,7 @@ func pushCommand(cmd *cobra.Command, args []string) {
var repo, refspec string
if len(args) < 1 {
Print("Usage: git hawser push --dry-run <repo> [refspec]")
Print("Usage: git lfs push --dry-run <repo> [refspec]")
return
}
@ -112,7 +107,7 @@ func pushCommand(cmd *cobra.Command, args []string) {
// Just use scanner here
pointers, err := scanner.Scan(left, right)
if err != nil {
Panic(err, "Error scanning for hawser files")
Panic(err, "Error scanning for Git LFS files")
}
for i, pointer := range pointers {
@ -130,22 +125,19 @@ func pushCommand(cmd *cobra.Command, args []string) {
}
}
// pushAsset pushes the asset with the given oid to the hawser endpoint. It will
// first make an OPTIONS call. If OPTIONS returns a 200 status, it indicates that the
// hawser endpoint already has a hawser object for that oid. The object will
// not be pushed again.
func pushAsset(oid, filename string, index, totalFiles int) *hawser.WrappedError {
// pushAsset pushes the asset with the given oid to the Git LFS API.
func pushAsset(oid, filename string, index, totalFiles int) *lfs.WrappedError {
tracerx.Printf("checking_asset: %s %s %d/%d", oid, filename, index, totalFiles)
path, err := hawser.LocalMediaPath(oid)
path, err := lfs.LocalMediaPath(oid)
if err != nil {
return hawser.Errorf(err, "Error uploading file %s (%s)", filename, oid)
return lfs.Errorf(err, "Error uploading file %s (%s)", filename, oid)
}
if err := ensureFile(filename, path); err != nil {
return hawser.Errorf(err, "Error uploading file %s (%s)", filename, oid)
return lfs.Errorf(err, "Error uploading file %s (%s)", filename, oid)
}
cb, file, cbErr := hawser.CopyCallbackFile("push", filename, index, totalFiles)
cb, file, cbErr := lfs.CopyCallbackFile("push", filename, index, totalFiles)
if cbErr != nil {
Error(cbErr.Error())
}
@ -154,7 +146,7 @@ func pushAsset(oid, filename string, index, totalFiles int) *hawser.WrappedError
defer file.Close()
}
return hawser.Upload(path, filename, cb)
return lfs.Upload(path, filename, cb)
}
// ensureFile makes sure that the cleanPath exists before pushing it. If it
@ -165,7 +157,7 @@ func ensureFile(smudgePath, cleanPath string) error {
}
expectedOid := filepath.Base(cleanPath)
localPath := filepath.Join(hawser.LocalWorkingDir, smudgePath)
localPath := filepath.Join(lfs.LocalWorkingDir, smudgePath)
file, err := os.Open(localPath)
if err != nil {
return err

@ -2,7 +2,7 @@ package commands
import (
"bufio"
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
"io/ioutil"
"os"
@ -24,10 +24,10 @@ var (
)
func removeCommand(cmd *cobra.Command, args []string) {
hawser.InstallHooks(false)
lfs.InstallHooks(false)
if len(args) < 1 {
Print("git hawser path rm <path> [path]*")
Print("git lfs path rm <path> [path]*")
return
}
@ -47,7 +47,7 @@ func removeCommand(cmd *cobra.Command, args []string) {
scanner := bufio.NewScanner(attributes)
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, "filter=hawser") {
if strings.Contains(line, "filter=lfs") {
fields := strings.Fields(line)
removeThisPath := false
for _, t := range args {

@ -2,8 +2,8 @@ package commands
import (
"bytes"
"github.com/hawser/git-hawser/hawser"
"github.com/hawser/git-hawser/pointer"
"github.com/github/git-lfs/lfs"
"github.com/github/git-lfs/pointer"
"github.com/spf13/cobra"
"io"
"os"
@ -20,7 +20,7 @@ var (
)
func smudgeCommand(cmd *cobra.Command, args []string) {
hawser.InstallHooks(false)
lfs.InstallHooks(false)
b := &bytes.Buffer{}
r := io.TeeReader(os.Stdin, b)
@ -36,7 +36,7 @@ func smudgeCommand(cmd *cobra.Command, args []string) {
}
if smudgeInfo {
localPath, err := hawser.LocalMediaPath(ptr.Oid)
localPath, err := lfs.LocalMediaPath(ptr.Oid)
if err != nil {
Exit(err.Error())
}
@ -51,7 +51,7 @@ func smudgeCommand(cmd *cobra.Command, args []string) {
}
filename := smudgeFilename(args, err)
cb, file, err := hawser.CopyCallbackFile("smudge", filename, 1, 1)
cb, file, err := lfs.CopyCallbackFile("smudge", filename, 1, 1)
if err != nil {
Error(err.Error())
}

@ -2,15 +2,15 @@ package commands
import (
"fmt"
"github.com/hawser/git-hawser/git"
"github.com/hawser/git-hawser/scanner"
"github.com/github/git-lfs/git"
"github.com/github/git-lfs/scanner"
"github.com/spf13/cobra"
)
var (
statusCmd = &cobra.Command{
Use: "status",
Short: "Show information about hawser files that would be pushed",
Short: "Show information about Git LFS objects that would be pushed",
Run: statusCommand,
}
porcelain = false
@ -24,7 +24,7 @@ func statusCommand(cmd *cobra.Command, args []string) {
stagedPointers, err := scanner.ScanIndex()
if err != nil {
Panic(err, "Could not scan staging for hawser files")
Panic(err, "Could not scan staging for Git LFS objects")
}
if porcelain {
@ -52,7 +52,7 @@ func statusCommand(cmd *cobra.Command, args []string) {
pointers, err := scanner.Scan(ref, "^"+remoteRef)
if err != nil {
Panic(err, "Could not scan for hawser files")
Panic(err, "Could not scan for Git LFS objects")
}
remote, err := git.CurrentRemote()
@ -60,13 +60,13 @@ func statusCommand(cmd *cobra.Command, args []string) {
Panic(err, "Could not get current remote branch")
}
Print("Hawser file changes to be pushed to %s:\n", remote)
Print("Git LFS objects to be pushed to %s:\n", remote)
for _, p := range pointers {
Print("\t%s (%s)", p.Name, humanizeBytes(p.Size))
}
}
Print("\nHawser file changes to be committed:\n")
Print("\nGit LFS objects to be committed:\n")
for _, p := range stagedPointers {
switch p.Status {
case "R", "C":
@ -77,7 +77,7 @@ func statusCommand(cmd *cobra.Command, args []string) {
}
}
Print("\nHawser file changes not staged for commit:\n")
Print("\nGit LFS objects not staged for commit:\n")
for _, p := range stagedPointers {
if p.Status == "M" {
Print("\t%s", p.Name)

@ -1,27 +1,27 @@
package commands
import (
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
)
var (
updateCmd = &cobra.Command{
Use: "update",
Short: "Update local hawser configuration",
Short: "Update local Git LFS configuration",
Run: updateCommand,
}
)
// updateCommand is used for updating parts of hawser that reside
// under .git/hawser.
// updateCommand is used for updating parts of Git LFS that reside under
// .git/lfs.
func updateCommand(cmd *cobra.Command, args []string) {
updatePrePushHook()
}
// updatePrePushHook will force an update of the pre-push hook.
func updatePrePushHook() {
hawser.InstallHooks(true)
lfs.InstallHooks(true)
Print("Updated pre-push hook")
}

@ -1,7 +1,7 @@
package commands
import (
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
)
@ -16,7 +16,7 @@ var (
)
func versionCommand(cmd *cobra.Command, args []string) {
Print(hawser.UserAgent)
Print(lfs.UserAgent)
if lovesComics {
Print("Nothing may see Gah Lak Tus and survive!")

@ -3,7 +3,7 @@ package commands
import (
"bytes"
"fmt"
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"github.com/spf13/cobra"
"io"
"log"
@ -20,8 +20,8 @@ var (
ErrorWriter = io.MultiWriter(os.Stderr, ErrorBuffer)
OutputWriter = io.MultiWriter(os.Stdout, ErrorBuffer)
RootCmd = &cobra.Command{
Use: "git-hawser",
Short: "Hawser provides large file support to Git.",
Use: "git-lfs",
Short: "Git LFS provides large file storage to Git.",
Run: func(cmd *cobra.Command, args []string) {
versionCommand(cmd, args)
cmd.Usage()
@ -65,7 +65,7 @@ func LoggedError(err error, format string, args ...interface{}) {
file := handlePanic(err)
if len(file) > 0 {
fmt.Fprintf(os.Stderr, "\nErrors logged to %s.\nUse `git hawser logs last` to view the log.\n", file)
fmt.Fprintf(os.Stderr, "\nErrors logged to %s.\nUse `git lfs logs last` to view the log.\n", file)
}
}
@ -101,7 +101,7 @@ func handlePanic(err error) string {
}
func logEnv(w io.Writer) {
for _, env := range hawser.Environ() {
for _, env := range lfs.Environ() {
fmt.Fprintln(w, env)
}
}
@ -109,14 +109,14 @@ func logEnv(w io.Writer) {
func logPanic(loggedError error, recursive bool) string {
var fmtWriter io.Writer = os.Stderr
if err := os.MkdirAll(hawser.LocalLogDir, 0755); err != nil {
fmt.Fprintf(fmtWriter, "Unable to log panic to %s: %s\n\n", hawser.LocalLogDir, err.Error())
if err := os.MkdirAll(lfs.LocalLogDir, 0755); err != nil {
fmt.Fprintf(fmtWriter, "Unable to log panic to %s: %s\n\n", lfs.LocalLogDir, err.Error())
return ""
}
now := time.Now()
name := now.Format("20060102T150405.999999999")
full := filepath.Join(hawser.LocalLogDir, name+".log")
full := filepath.Join(lfs.LocalLogDir, name+".log")
file, err := os.Create(full)
if err == nil {
@ -145,7 +145,7 @@ func logPanic(loggedError error, recursive bool) string {
}
fmtWriter.Write(wErr.Stack())
} else {
fmtWriter.Write(hawser.Stack())
fmtWriter.Write(lfs.Stack())
}
if err != nil && !recursive {

@ -149,7 +149,7 @@ type TestCommand struct {
}
func (c *TestCommand) Run(path string) {
fmt.Println("$ git hawser", strings.Join(c.Args, " "))
fmt.Println("$ git lfs", strings.Join(c.Args, " "))
for _, cb := range c.BeforeCallbacks {
cb()
@ -221,7 +221,7 @@ func clone(t *testing.T, name, path string) {
cmd(t, "git", "clone", name, path)
e(t, os.Chdir(path))
cmd(t, "git", "remote", "remove", "origin")
cmd(t, "git", "remote", "add", "origin", "https://example.com/git/hawser")
cmd(t, "git", "remote", "add", "origin", "https://example.com/git/lfs")
}
func init() {
@ -231,8 +231,8 @@ func init() {
}
Root = filepath.Join(wd, "..")
Bin = filepath.Join(Root, "bin", "git-hawser")
TempDir = filepath.Join(os.TempDir(), "hawser-tests")
Bin = filepath.Join(Root, "bin", "git-lfs")
TempDir = filepath.Join(os.TempDir(), "git-lfs-tests")
env := os.Environ()
GitEnv = make([]string, 0, len(env))

@ -16,11 +16,11 @@ func TestEnv(t *testing.T) {
cmd := repo.Command("env")
SetConfigOutput(cmd, map[string]string{
"Endpoint": "https://example.com/git/hawser.git/info/media",
"Endpoint": "https://example.com/git/lfs.git/info/media",
"LocalWorkingDir": repo.Path,
"LocalGitDir": filepath.Join(repo.Path, ".git"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "hawser", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "hawser", "tmp"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "lfs", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "lfs", "tmp"),
})
}
@ -33,8 +33,8 @@ func TestEnvWithMediaUrl(t *testing.T) {
"Endpoint": "http://foo/bar",
"LocalWorkingDir": repo.Path,
"LocalGitDir": filepath.Join(repo.Path, ".git"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "hawser", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "hawser", "tmp"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "lfs", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "lfs", "tmp"),
})
}
@ -44,11 +44,11 @@ func TestEnvWithSubmoduleFromRepository(t *testing.T) {
cmd := repo.Command("env")
SetConfigOutput(cmd, map[string]string{
"Endpoint": "https://example.com/git/hawser.git/info/media",
"Endpoint": "https://example.com/git/lfs.git/info/media",
"LocalWorkingDir": repo.Path,
"LocalGitDir": filepath.Join(repo.Path, ".git"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "hawser", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "hawser", "tmp"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "lfs", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "lfs", "tmp"),
})
cmd.Before(func() {
@ -88,8 +88,8 @@ func TestEnvWithConfiguredSubmodule(t *testing.T) {
"Endpoint": "http://foo/bar",
"LocalWorkingDir": filepath.Join(repo.Path, "config_media_url"),
"LocalGitDir": filepath.Join(repo.Path, ".git", "modules", "config_media_url"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "modules", "config_media_url", "hawser", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "modules", "config_media_url", "hawser", "tmp"),
"LocalMediaDir": filepath.Join(repo.Path, ".git", "modules", "config_media_url", "lfs", "objects"),
"TempDir": filepath.Join(repo.Path, ".git", "modules", "config_media_url", "lfs", "tmp"),
})
cmd.Before(func() {

@ -17,7 +17,7 @@ func TestInit(t *testing.T) {
repo.AddPath(repo.Path, "subdir")
cmd := repo.Command("init")
cmd.Output = "git hawser initialized"
cmd.Output = "git lfs initialized"
prePushHookFile := filepath.Join(repo.Path, ".git", "hooks", "pre-push")
@ -27,14 +27,14 @@ func TestInit(t *testing.T) {
})
cmd.After(func() {
// assert hawser filter config
// assert filter config
configs := GlobalGitConfig(t)
AssertIncludeString(t, "filter.hawser.clean=git hawser clean %f", configs)
AssertIncludeString(t, "filter.hawser.smudge=git hawser smudge %f", configs)
AssertIncludeString(t, "filter.hawser.required=true", configs)
AssertIncludeString(t, "filter.lfs.clean=git lfs clean %f", configs)
AssertIncludeString(t, "filter.lfs.smudge=git lfs smudge %f", configs)
AssertIncludeString(t, "filter.lfs.required=true", configs)
found := 0
for _, line := range configs {
if strings.HasPrefix(line, "filter.hawser") {
if strings.HasPrefix(line, "filter.lfs") {
found += 1
}
}
@ -47,7 +47,7 @@ func TestInit(t *testing.T) {
})
cmd = repo.Command("init")
cmd.Output = "Hook already exists: pre-push\ngit hawser initialized"
cmd.Output = "Hook already exists: pre-push\ngit lfs initialized"
customHook := []byte("echo 'yo'")
cmd.Before(func() {

@ -14,9 +14,9 @@ func TestLsFiles(t *testing.T) {
cmd.Before(func() {
path := filepath.Join(".git", "info", "attributes")
repo.WriteFile(path, "*.dat filter=hawser -crlf\n")
repo.WriteFile(path, "*.dat filter=lfs -crlf\n")
// Add a hawser file
// Add a Git LFS object
repo.WriteFile(filepath.Join(repo.Path, "a.dat"), "some data")
repo.GitCmd("add", "a.dat")
repo.GitCmd("commit", "-m", "a")

@ -25,7 +25,7 @@ func TestPath(t *testing.T) {
cmd.Before(func() {
// write attributes file in .git
path := filepath.Join(".git", "info", "attributes")
repo.WriteFile(path, "*.mov filter=hawser -crlf\n")
repo.WriteFile(path, "*.mov filter=lfs -crlf\n")
// add hook
err := ioutil.WriteFile(prePushHookFile, customHook, 0755)
@ -51,12 +51,12 @@ func TestPathOnEmptyRepository(t *testing.T) {
cmd.Before(func() {
// write attributes file in .git
path := filepath.Join(".gitattributes")
repo.WriteFile(path, "*.mov filter=hawser -crlf\n")
repo.WriteFile(path, "*.mov filter=lfs -crlf\n")
})
cmd.After(func() {
// assert path was added
assert.Equal(t, "*.mov filter=hawser -crlf\n*.gif filter=hawser -crlf\n", repo.ReadFile(".gitattributes"))
assert.Equal(t, "*.mov filter=lfs -crlf\n*.gif filter=lfs -crlf\n", repo.ReadFile(".gitattributes"))
expected := "Listing paths\n *.mov (.gitattributes)\n *.gif (.gitattributes)\n"
@ -84,12 +84,12 @@ func TestAddPathWithoutTrailingLinebreak(t *testing.T) {
cmd.Before(func() {
// write attributes file in .git
path := filepath.Join(".gitattributes")
repo.WriteFile(path, "*.mov filter=hawser -crlf")
repo.WriteFile(path, "*.mov filter=lfs -crlf")
})
cmd.After(func() {
// assert path was added
assert.Equal(t, "*.mov filter=hawser -crlf\n*.gif filter=hawser -crlf\n", repo.ReadFile(".gitattributes"))
assert.Equal(t, "*.mov filter=lfs -crlf\n*.gif filter=lfs -crlf\n", repo.ReadFile(".gitattributes"))
expected := "Listing paths\n *.mov (.gitattributes)\n *.gif (.gitattributes)\n"

@ -28,7 +28,7 @@ func TestPushToMaster(t *testing.T) {
repo.GitCmd("fetch")
repo.WriteFile(filepath.Join(repo.Path, ".gitattributes"), "*.dat filter=hawser -crlf\n")
repo.WriteFile(filepath.Join(repo.Path, ".gitattributes"), "*.dat filter=lfs -crlf\n")
// Add a hawser file
repo.WriteFile(filepath.Join(repo.Path, "a.dat"), "some data")
@ -52,7 +52,7 @@ func TestPushToNewBranch(t *testing.T) {
repo.GitCmd("fetch")
repo.WriteFile(filepath.Join(repo.Path, ".gitattributes"), "*.dat filter=hawser -crlf\n")
repo.WriteFile(filepath.Join(repo.Path, ".gitattributes"), "*.dat filter=lfs -crlf\n")
repo.GitCmd("add", ".gitattributes")
repo.GitCmd("commit", "-m", "attributes")

2
commands/repos/attributes.git/config Executable file → Normal file

@ -6,7 +6,7 @@
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = file:///Users/scott/github/git-hawser/commands/repos/attributes.git/
url = /Users/rick/github/git-hawser/commands/repos/attributes.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin

@ -1,2 +1,2 @@
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a rubyist <scott.barron@github.com> 1422646325 -0500 clone: from file:///Users/scott/github/git-hawser/commands/repos/attributes.git/
f554c0ff0e7525ec508b489a720a89819cd5d84a 0afe8279f991e5f192acb8ac06cc4838fdd60941 rubyist <scott.barron@github.com> 1422646583 -0500 commit: update attributes
0000000000000000000000000000000000000000 57b40745b3d6479ad9d9ad0523c1569e183e38ca Rick Olson <technoweenie@gmail.com> 1426793357 -0600 clone: from /Users/rick/github/git-hawser/commands/repos/attributes.git
57b40745b3d6479ad9d9ad0523c1569e183e38ca 7aae26c4771bac634e5c15484657aa439c4ef7e0 Rick Olson <technoweenie@gmail.com> 1426793389 -0600 commit: add .gitattributes for ./a

@ -1,2 +1,2 @@
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a rubyist <scott.barron@github.com> 1422646325 -0500 clone: from file:///Users/scott/github/git-hawser/commands/repos/attributes.git/
f554c0ff0e7525ec508b489a720a89819cd5d84a 0afe8279f991e5f192acb8ac06cc4838fdd60941 rubyist <scott.barron@github.com> 1422646583 -0500 commit: update attributes
0000000000000000000000000000000000000000 57b40745b3d6479ad9d9ad0523c1569e183e38ca Rick Olson <technoweenie@gmail.com> 1426793357 -0600 clone: from /Users/rick/github/git-hawser/commands/repos/attributes.git
57b40745b3d6479ad9d9ad0523c1569e183e38ca 7aae26c4771bac634e5c15484657aa439c4ef7e0 Rick Olson <technoweenie@gmail.com> 1426793389 -0600 commit: add .gitattributes for ./a

@ -0,0 +1 @@
0000000000000000000000000000000000000000 57b40745b3d6479ad9d9ad0523c1569e183e38ca Rick Olson <technoweenie@gmail.com> 1426793357 -0600 clone: from /Users/rick/github/git-hawser/commands/repos/attributes.git

@ -1 +0,0 @@
x<01>ÎAn! @Ñ®9hdÀÎ)ªr¦™Å„ˆ1Þ>9C·_zÒ¯ã8vó1Å/›ªž{ÒrfĦ˜ "sJ"1ÄV2º—L}šïDX¡wÐ<77>"i%àœe œ9äÚ¨1Š“e<E2809C>1ý\åo?ÍßÎ:Ì.EæÏûïn<C3AF>U.u?>`ŒW¼'ÿ à>õ³hú/ìÖ«‰©³¹—ezº7_pJ[

@ -0,0 +1,2 @@
# pack-refs with: peeled fully-peeled
57b40745b3d6479ad9d9ad0523c1569e183e38ca refs/remotes/origin/master

@ -1 +1 @@
0afe8279f991e5f192acb8ac06cc4838fdd60941
7aae26c4771bac634e5c15484657aa439c4ef7e0

@ -0,0 +1 @@
ref: refs/remotes/origin/master

6
commands/repos/config_media_url.git/config Executable file → Normal file

@ -5,9 +5,3 @@
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /Users/scott/github/git-hawser/commands/repos/config_media_url.git/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

@ -1,2 +1 @@
0000000000000000000000000000000000000000 00df65f30b769b694e2a1ca57e054d45d3d8bf9b rubyist <scott.barron@github.com> 1422648036 -0500 clone: from /Users/scott/github/git-hawser/commands/repos/config_media_url.git/
00df65f30b769b694e2a1ca57e054d45d3d8bf9b 89ea2bf17b7a9e86085513d3c78b5197fd13a4c1 rubyist <scott.barron@github.com> 1422648050 -0500 commit: Update config
0000000000000000000000000000000000000000 d1e0a8e1530c458f27d4aac7da7d4f3732e9888b Rick Olson <technoweenie@gmail.com> 1426793050 -0600 commit (initial): add .gitconfig with custom Git LFS url

@ -1,2 +1 @@
0000000000000000000000000000000000000000 00df65f30b769b694e2a1ca57e054d45d3d8bf9b rubyist <scott.barron@github.com> 1422648036 -0500 clone: from /Users/scott/github/git-hawser/commands/repos/config_media_url.git/
00df65f30b769b694e2a1ca57e054d45d3d8bf9b 89ea2bf17b7a9e86085513d3c78b5197fd13a4c1 rubyist <scott.barron@github.com> 1422648050 -0500 commit: Update config
0000000000000000000000000000000000000000 d1e0a8e1530c458f27d4aac7da7d4f3732e9888b Rick Olson <technoweenie@gmail.com> 1426793050 -0600 commit (initial): add .gitconfig with custom Git LFS url

@ -1,2 +0,0 @@
x<01>Í[
à @Ñ~»ŠÙ@ƒ&ñ¡t…îÀŒ£FRK·ß¬¡¿¹ÖÒA9}éÌät²n¤HÑÛirkÔ&Y=&¯µ5¥Y=*/§o|À³à û›,<2C>pkü%j…²ÈõjjÆ[Wi¤g=§<>þä"ÄC.¹¥’Å;ð<O

@ -1 +0,0 @@
x<01>ŽË Ã0sVÛ@Œ¬¿!„4´ÒÊÑÁׇtÕ<>Ëx©m[eP*ܸAQhMDi H´ Y{—¬#.ä­´3H™³EKônA·RqNÑzÖdc³ÎË‚"^üiú…ßz2<ÎÔ˜'Œ½·ýµVþ\8¥¶=a6J9¤•p#Å°ã"Ó_±x92Aj{©«ø½AI

@ -1 +1 @@
89ea2bf17b7a9e86085513d3c78b5197fd13a4c1
d1e0a8e1530c458f27d4aac7da7d4f3732e9888b

@ -6,10 +6,10 @@
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /Users/rick/hawser/git-hawser/commands/repos/submodule.git
url = /Users/rick/github/git-lfs/commands/repos/submodule.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "attributes"]
url = /Users/rick/hawser/git-hawser/commands/repos/attributes.git
url = /Users/rick/github/git-lfs/commands/repos/attributes.git

@ -1,2 +1,2 @@
0000000000000000000000000000000000000000 b608e68155fac7a7d9bfa126de62ba3f10a33e30 Rick Olson <technoweenie@gmail.com> 1402007980 -0600 clone: from /Users/rick/hawser/git-hawser/commands/repos/submodule.git
0000000000000000000000000000000000000000 b608e68155fac7a7d9bfa126de62ba3f10a33e30 Rick Olson <technoweenie@gmail.com> 1402007980 -0600 clone: from /Users/rick/github/git-lfs/commands/repos/submodule.git
b608e68155fac7a7d9bfa126de62ba3f10a33e30 862c32b0f154e2f48374c9bb66811732bce51fce Rick Olson <technoweenie@gmail.com> 1402008046 -0600 commit (amend): add submodule

@ -1,2 +1,2 @@
0000000000000000000000000000000000000000 b608e68155fac7a7d9bfa126de62ba3f10a33e30 Rick Olson <technoweenie@gmail.com> 1402007980 -0600 clone: from /Users/rick/hawser/git-hawser/commands/repos/submodule.git
0000000000000000000000000000000000000000 b608e68155fac7a7d9bfa126de62ba3f10a33e30 Rick Olson <technoweenie@gmail.com> 1402007980 -0600 clone: from /Users/rick/github/git-lfs/commands/repos/submodule.git
b608e68155fac7a7d9bfa126de62ba3f10a33e30 862c32b0f154e2f48374c9bb66811732bce51fce Rick Olson <technoweenie@gmail.com> 1402008046 -0600 commit (amend): add submodule

@ -1 +1 @@
0000000000000000000000000000000000000000 b608e68155fac7a7d9bfa126de62ba3f10a33e30 Rick Olson <technoweenie@gmail.com> 1402007980 -0600 clone: from /Users/rick/hawser/git-hawser/commands/repos/submodule.git
0000000000000000000000000000000000000000 b608e68155fac7a7d9bfa126de62ba3f10a33e30 Rick Olson <technoweenie@gmail.com> 1402007980 -0600 clone: from /Users/rick/github/git-lfs/commands/repos/submodule.git

@ -7,7 +7,7 @@
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /Users/rick/hawser/git-hawser/commands/repos/attributes.git
url = /Users/rick/github/git-lfs/commands/repos/attributes.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin

@ -1 +1 @@
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a Rick Olson <technoweenie@gmail.com> 1402008021 -0600 clone: from /Users/rick/hawser/git-hawser/commands/repos/attributes.git
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a Rick Olson <technoweenie@gmail.com> 1402008021 -0600 clone: from /Users/rick/github/git-lfs/commands/repos/attributes.git

@ -1 +1 @@
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a Rick Olson <technoweenie@gmail.com> 1402008021 -0600 clone: from /Users/rick/hawser/git-hawser/commands/repos/attributes.git
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a Rick Olson <technoweenie@gmail.com> 1402008021 -0600 clone: from /Users/rick/github/git-lfs/commands/repos/attributes.git

@ -1 +1 @@
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a Rick Olson <technoweenie@gmail.com> 1402008021 -0600 clone: from /Users/rick/hawser/git-hawser/commands/repos/attributes.git
0000000000000000000000000000000000000000 f554c0ff0e7525ec508b489a720a89819cd5d84a Rick Olson <technoweenie@gmail.com> 1402008021 -0600 clone: from /Users/rick/github/git-lfs/commands/repos/attributes.git

@ -18,12 +18,12 @@ func TestSmudge(t *testing.T) {
// simple smudge example
cmd := repo.Command("smudge", "somefile")
cmd.Input = bytes.NewBufferString("version https://hawser.github.com/spec/v1\noid sha256:SOMEOID\nsize 9\n")
cmd.Input = bytes.NewBufferString("version https://git-lfs.github.com/spec/v1\noid sha256:SOMEOID\nsize 9\n")
cmd.Output = "whatever"
cmd.Env = append(cmd.Env, "HAWSER_PROGRESS="+progressFile)
cmd.Env = append(cmd.Env, "GIT_LFS_PROGRESS="+progressFile)
cmd.Before(func() {
path := filepath.Join(repo.Path, ".git", "hawser", "objects", "SO", "ME")
path := filepath.Join(repo.Path, ".git", "lfs", "objects", "SO", "ME")
file := filepath.Join(path, "SOMEOID")
assert.Equal(t, nil, os.MkdirAll(path, 0755))
assert.Equal(t, nil, ioutil.WriteFile(file, []byte("whatever\n"), 0755))
@ -51,7 +51,7 @@ func TestSmudge(t *testing.T) {
customHook := []byte("echo 'yo'")
cmd.Before(func() {
path := filepath.Join(repo.Path, ".git", "hawser", "objects", "4d", "7a")
path := filepath.Join(repo.Path, ".git", "lfs", "objects", "4d", "7a")
file := filepath.Join(path, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393")
assert.Equal(t, nil, os.MkdirAll(path, 0755))
assert.Equal(t, nil, ioutil.WriteFile(file, []byte("whatever\n"), 0755))
@ -70,7 +70,7 @@ func TestSmudgeInfo(t *testing.T) {
repo := NewRepository(t, "empty")
defer repo.Test()
mediaPath := filepath.Join(repo.Path, ".git", "hawser", "objects", "4d", "7a")
mediaPath := filepath.Join(repo.Path, ".git", "lfs", "objects", "4d", "7a")
mediaFile := filepath.Join(mediaPath, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393")
// smudge --info with old pointer format, without local file
@ -103,14 +103,14 @@ func TestSmudgeInfo(t *testing.T) {
assert.Equal(t, nil, ioutil.WriteFile(mediaFile, []byte("whatever\n"), 0755))
})
// smudge --info with hawser pointer format, without local file
// smudge --info with Git LFS pointer format, without local file
cmd = repo.Command("smudge", "--info")
cmd.Input = bytes.NewBufferString("version https://hawser.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 123\n")
cmd.Input = bytes.NewBufferString("version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 123\n")
cmd.Output = "123 --"
// smudge --info with hawser pointer format, with local file
// smudge --info with Git LFS pointer format, with local file
cmd = repo.Command("smudge", "--info")
cmd.Input = bytes.NewBufferString("version https://hawser.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 123\n")
cmd.Input = bytes.NewBufferString("version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 123\n")
cmd.Output = "9 " + mediaFile
cmd.Before(func() {

@ -14,7 +14,7 @@ func TestStatus(t *testing.T) {
cmd.Before(func() {
path := filepath.Join(".git", "info", "attributes")
repo.WriteFile(path, "*.dat filter=hawser -crlf\n")
repo.WriteFile(path, "*.dat filter=lfs -crlf\n")
// Add a hawser file
repo.WriteFile(filepath.Join(repo.Path, "file1.dat"), "some data")

@ -2,7 +2,7 @@ package commands
import (
"fmt"
"github.com/hawser/git-hawser/hawser"
"github.com/github/git-lfs/lfs"
"testing"
)
@ -14,11 +14,11 @@ func TestVersionOnEmptyRepository(t *testing.T) {
repo.AddPath(repo.Path, "subdir")
cmd := repo.Command("version")
cmd.Output = hawser.UserAgent
cmd.Output = lfs.UserAgent
cmd = repo.Command("version", "--comics")
cmd.Output = fmt.Sprintf("%s\nNothing may see Gah Lak Tus and survive!", hawser.UserAgent)
cmd.Output = fmt.Sprintf("%s\nNothing may see Gah Lak Tus and survive!", lfs.UserAgent)
cmd = repo.Command("version", "-c")
cmd.Output = fmt.Sprintf("%s\nNothing may see Gah Lak Tus and survive!", hawser.UserAgent)
cmd.Output = fmt.Sprintf("%s\nNothing may see Gah Lak Tus and survive!", lfs.UserAgent)
}

@ -1,13 +1,13 @@
# Hawser API
# Git LFS API
The server implements a simple API for uploading and downloading binary content.
Git repositories that use Hawser will specify a URI endpoint. See the
Git repositories that use Git LFS will specify a URI endpoint. See the
[specification](spec.md) for how Git Media determines the server endpoint to use.
Use that endpoint as a base, and append the following relative paths to upload
and download from the Hawser server.
and download from the Git LFS server.
All requests should send an Accept header of `application/vnd.hawser+json`.
All requests should send an Accept header of `application/vnd.git-lfs+json`.
This may change in the future as the API evolves.
## API Responses
@ -30,7 +30,7 @@ repository or requested object does not exist.
The following status codes can optionally be returned from the API, depending on
the server implementation.
* 406 - The Accept header is invalid. It should be `application/vnd.hawser+json`.
* 406 - The Accept header is invalid. It should be `application/vnd.git-lfs+json`.
* 429 - The user has hit a rate limit with the server. Though the API does not
specify any rate limits, implementors are encouraged to set some for
availability reasons.
@ -47,15 +47,15 @@ If the server returns a JSON error object, the client can display this message
to users.
```
> GET https://hawser-server.com/objects/{OID} HTTP/1.1
> Accept: application/vnd.hawser+json
> GET https://git-lfs-server.com/objects/{OID} HTTP/1.1
> Accept: application/vnd.git-lfs+json
>
< HTTP/1.1 200 OK
< Content-Type: application/vnd.hawser+json
< Content-Type: application/vnd.git-lfs+json
<
< {
< "message": "Bad credentials",
< "documentation_url": "https://hawser-server.com/docs/errors",
< "documentation_url": "https://git-lfs-server.com/docs/errors",
< "request_id": "123"
< }
```
@ -65,7 +65,7 @@ they are displayed to the user.
## Hypermedia
The Hawser API uses hypermedia hints to instruct the client what to do next.
The Git LFS API uses hypermedia hints to instruct the client what to do next.
These links are included in a `_links` property. Possible relations for objects
include:
@ -79,18 +79,18 @@ See the "Verification" section below for more.
Link relations specify the `href`, and optionally a collection of header values
to set for the request. These are optional, and depend on the backing object
store that the Hawser API is using.
store that the Git LFS API is using.
The Hawser client will automatically send the same credentials to the followed
The Git LFS client will automatically send the same credentials to the followed
link relation as Basic Authentication IF:
* The url scheme, host, and port all match the Hawser API endpoint's.
* The url scheme, host, and port all match the Git LFS API endpoint's.
* The link relation does not specify an Authorization header.
If the host name is different, the Hawser API needs to send enough information
If the host name is different, the Git LFS API needs to send enough information
through the href query or header values to authenticate the request.
The Hawser client expects a 200 or 201 response from these hypermedia requests.
The Git LFS client expects a 200 or 201 response from these hypermedia requests.
Any other response code is treated as an error.
## GET /objects/{oid}
@ -98,19 +98,19 @@ Any other response code is treated as an error.
This gets the object's meta data. The OID is the value from the object pointer.
```
> GET https://hawser-server.com/objects/{OID} HTTP/1.1
> Accept: application/vnd.hawser+json
> GET https://git-lfs-server.com/objects/{OID} HTTP/1.1
> Accept: application/vnd.git-lfs+json
> Authorization: Basic ... (if authentication is needed)
>
< HTTP/1.1 200 OK
< Content-Type: application/vnd.hawser+json
< Content-Type: application/vnd.git-lfs+json
<
< {
< "oid": "the-sha-256-signature",
< "size": 123456,
< "_links": {
< "self": {
< "href": "https://hawser-server.com/objects/OID",
< "href": "https://git-lfs-server.com/objects/OID",
< },
< "download": {
< "href": "https://some-download.com",
@ -129,12 +129,12 @@ access the object content. See the "Hypermedia" section above for more.
Here's a sample response for a request with an authorization error:
```
> GET https://hawser-server.com/objects/{OID} HTTP/1.1
> Accept: application/vnd.hawser+json
> GET https://git-lfs-server.com/objects/{OID} HTTP/1.1
> Accept: application/vnd.git-lfs+json
> Authorization: Basic ... (if authentication is needed)
>
< HTTP/1.1 404 Not found
< Content-Type: application/vnd.hawser+json
< Content-Type: application/vnd.git-lfs+json
<
< {
< "message": "Not found"
@ -153,9 +153,9 @@ This request initiates the upload of an object, given a JSON body with the oid
and size of the object to upload.
```
> POST https://hawser-server.com/objects/ HTTP/1.1
> Accept: application/vnd.hawser+json
> Content-Type: application/vnd.hawser+json
> POST https://git-lfs-server.com/objects/ HTTP/1.1
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ... (if authentication is needed)
>
> {
@ -164,7 +164,7 @@ and size of the object to upload.
> }
>
< HTTP/1.1 202 Accepted
< Content-Type: application/vnd.hawser+json
< Content-Type: application/vnd.git-lfs+json
<
< {
< "_links": {
@ -206,18 +206,17 @@ only appears on a 200 status.
## Verification
When Hawser clients issue a POST request to initiate an object upload, the
response can potentially return a "verify" link relation. If given, The Hawser
server expects a POST to the href after a successful upload. Hawser
clients send:
When Git LFS clients issue a POST request to initiate an object upload, the
response can potentially return a "verify" link relation. If given, The Git LFS
API expects a POST to the href after a successful upload. Git LFS clients send:
* `oid` - The String OID of the Git Media object.
* `size` - The integer size of the Git Media object.
```
> POST https://hawser-server.com/callback
> Accept: application/vnd.hawser
> Content-Type: application/vnd.hawser+json
> POST https://git-lfs-server.com/callback
> Accept: application/vnd.git-lfs
> Content-Type: application/vnd.git-lfs+json
> Content-Length: 123
>
> {"oid": "{oid}", "size": 10000}

@ -10,21 +10,21 @@ sudo apt-get install golang-go git
./script/bootstrap
```
That will place a git-hawser binary in the `bin/` directory. Copy the binary to a directory in your path:
That will place a git-lfs binary in the `bin/` directory. Copy the binary to a directory in your path:
```
sudo cp bin/git-hawser /usr/local/bin
sudo cp bin/git-lfs /usr/local/bin
```
Try it:
```
[949][rubiojr@octox] git hawser
git-hawser v0.0.1
[949][rubiojr@octox] git lfs
git-lfs v0.0.1
[~]
[949][rubiojr@octox] git hawser init
git hawser initialized
[949][rubiojr@octox] git lfs init
git lfs initialized
```
### Installing the man pages
@ -40,4 +40,4 @@ sudo mkdir -p /usr/local/share/man/man1
sudo cp man/*.1 /usr/local/share/man/man1
```
`git help hawser` should show the git-hawser manpage now.
`git help lfs` should show the git-lfs man pages now.

@ -1,24 +1,24 @@
git-hawser-add(1) - Add Hawser paths to Git Attributes.
git-lfs-add(1) - Add Git LFS paths to Git Attributes.
======================================================================
## SYNOPSIS
`git hawser add` [path]*
`git lfs add` [path]*
## DESCRIPTION
The "path" command helps view and modify Git attributes for the "hawser"
The "path" command helps view and modify Git attributes for the "lfs"
clean and smudge filters. The "path" argument can be a file extension, or a
path.
## EXAMPLES
* Configure a path to use the Hawser clean and smudge filters.
* Configure a path to use the Git LFS clean and smudge filters.
`git hawser add *.gif`
`git lfs add *.gif`
## SEE ALSO
git-hawser-rm(1), git-hawser-path(1), git-hawser-init(1), gitattributes(5).
git-lfs-rm(1), git-lfs-path(1), git-lfs-init(1), gitattributes(5).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,21 +1,21 @@
git-hawser-clean(1) -- Git clean filter that converts large files to pointers.
git-lfs-clean(1) -- Git clean filter that converts large files to pointers.
=============================================================================
## SYNOPSIS
`git hawser clean` <path>
`git lfs clean` <path>
## DESCRIPTION
Clean calculates a SHA-256 signature of the data from STDOUT, and outputs a
Git Media pointer file. It also queues the file to be pushed by
git-hawser-push(1).
git-lfs-push(1).
Clean is typicall run by Git's clean filter, configured by the repository's
Git attributes.
## SEE ALSO
git-hawser-init(1), git-hawser-push(1), gitattributes(5).
git-lfs-init(1), git-lfs-push(1), gitattributes(5).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,9 +1,9 @@
git-hawser-env(1) -- Display the Git Media environment.
git-lfs-env(1) -- Display the Git Media environment.
=========================================================
## SYNOPSIS
`git hawser env`
`git lfs env`
## DESCRIPTION
@ -11,4 +11,4 @@ Displays the current Git Media environment.
## SEE ALSO
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,17 +1,17 @@
git-hawser-init(1) -- Ensure Hawser is configured properly.
git-lfs-init(1) -- Ensure Git LFS is configured properly.
=============================================================
## SYNOPSIS
`git hawser init`
`git lfs init`
## DESCRIPTION
Init performs the following actions to ensure Hawser is setup properly:
Init performs the following actions to ensure Git LFS is setup properly:
* Sets up the clean and smudge filters under the name "hawser".
* Installs a pre-push hook to run git-hawser-push(1)
* Sets up the clean and smudge filters under the name "lfs".
* Installs a pre-push hook to run git-lfs-push(1)
## SEE ALSO
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,21 +1,21 @@
git-hawser-logs(1) - Show errors from the git-hawser command.
git-lfs-logs(1) - Show errors from the git-lfs command.
===========================================================
## SYNOPSIS
`git hawser logs`<br>
`git hawser logs` <file><br>
`git hawser logs` --clear<br>
`git hawser logs` --boomtown<br>
`git lfs logs`<br>
`git lfs logs` <file><br>
`git lfs logs` --clear<br>
`git lfs logs` --boomtown<br>
## DESCRIPTION
The "logs" command displays errors from the git-hawser command. Any time it
crashes, the details are saved to ".git/hawser/logs".
The "logs" command displays errors from the git-lfs command. Any time it
crashes, the details are saved to ".git/lfs/logs".
## OPTIONS
Without any options, `git hawser logs` will simply show the list of error logs.
Without any options, `git lfs logs` will simply show the list of error logs.
* <file>:
Shows the specified error log. Use "last" to show the most recent error.

@ -1,17 +1,17 @@
git-hawser-ls-files(1) -- Show information about git hawser files in the index and working tree
git-lfs-ls-files(1) -- Show information about git lfs files in the index and working tree
=============================================================================================
## SYNOPSIS
`git hawser ls-files` [refspec]
`git lfs ls-files` [refspec]
## DESCRIPTION
Displays paths of hawser files that are found in the refspec. If no refspec is given,
Displays paths of Git LFS files that are found in the refspec. If no refspec is given,
the current checked out branch will be scanned.
## SEE ALSO
git-hawser-status(1).
git-lfs-status(1).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,13 +1,13 @@
git-hawser-path(1) - View Hawser paths in Git attributes.
git-lfs-path(1) - View Git LFS paths in Git attributes.
======================================================================
## SYNOPSIS
`git hawser path`
`git lfs path`
## DESCRIPTION
The "path" command helps view and modify Git attributes for the "hawser"
The "path" command helps view and modify Git attributes for the "lfs"
clean and smudge filters. The "path" argument can be a file extension, or a
path.
@ -15,10 +15,10 @@ path.
* View the current Git attributes.
`git hawser path`
`git lfs path`
## SEE ALSO
git-hawser-add(1), git-hawser-rm(1), git-hawser-init(1), gitattributes(5).
git-lfs-add(1), git-lfs-rm(1), git-lfs-init(1), gitattributes(5).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,9 +1,9 @@
git-hawser-push(1) -- Push queued large files to the Git Media endpoint.
git-lfs-push(1) -- Push queued large files to the Git Media endpoint.
=======================================================================
## SYNOPSIS
`git hawser push` <repo> [refspec]
`git lfs push` <repo> [refspec]
## DESCRIPTION
@ -25,6 +25,6 @@ Push is typically run by Git's pre-push hook.
## SEE ALSO
git-hawser-clean(1).
git-lfs-clean(1).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,24 +1,24 @@
git-hawser-rm(1) - Remove Hawser paths from Git Attributes.
git-lfs-rm(1) - Remove Git LFS paths from Git Attributes.
======================================================================
## SYNOPSIS
`git hawser rm` [path]*
`git lfs rm` [path]*
## DESCRIPTION
The "path" command helps view and modify Git attributes for the "hawser"
The "path" command helps view and modify Git attributes for the "lfs"
clean and smudge filters. The "path" argument can be a file extension, or a
path.
## EXAMPLES
* Prevent a path from using Hawser clean and smudge filters.
* Prevent a path from using Git LFS clean and smudge filters.
`git hawser rm *.gif`
`git lfs rm *.gif`
## SEE ALSO
git-hawser-add(1), git-hawser-path(1), git-hawser-init(1), gitattributes(5).
git-lfs-add(1), git-lfs-path(1), git-lfs-init(1), gitattributes(5).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,9 +1,9 @@
git-hawser-smudge(1) -- Git smudge filter that converts pointer in blobs to the actual content.
git-lfs-smudge(1) -- Git smudge filter that converts pointer in blobs to the actual content.
==============================================================================================
## SYNOPSIS
`git hawser smudge` <path>
`git lfs smudge` <path>
## DESCRIPTION
@ -17,7 +17,7 @@ Git attributes.
## OPTIONS
Without any options, `git hawser smudge` will output the raw hawser content to
Without any options, `git lfs smudge` will output the raw hawser content to
STDOUT.
* `--info`:
@ -26,6 +26,6 @@ STDOUT.
## SEE ALSO
git-hawser-init(1), gitattributes(5).
git-lfs-init(1), gitattributes(5).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,14 +1,14 @@
git-hawser-status(1) -- Show the status of hawser files in the working tree
git-lfs-status(1) -- Show the status of Git LFS files in the working tree
============================================================================
## SYNOPSIS
`git hawser status` [<options>]
`git lfs status` [<options>]
## DESCRIPTION
Displays paths of hawser files that have not been pushed to the hawser server,
have differences between the index file and the current HEAD commit,
Displays paths of Git LFS objects that have not been pushed to the Git LFS
server, have differences between the index file and the current HEAD commit,
and paths that have differences between the working tree and the index file.
Thi first are what you would push by running git push; the second are what
you would commit by running git commit; the third are what you could commit
@ -21,6 +21,6 @@ by running git add before running git commit.
## SEE ALSO
git-hawser-ls-files(1).
git-lfs-ls-files(1).
Part of the git-hawser(1) suite.
Part of the git-lfs(1) suite.

@ -1,9 +1,9 @@
git-hawser(1) -- Work with large files in Git repositories.
git-lfs(1) -- Work with large files in Git repositories.
==========================================================
## SYNOPSIS
`git hawser` <command> [<args>]
`git lfs` <command> [<args>]
## DESCRIPTION
@ -20,20 +20,20 @@ commands and low level ("plumbing") commands.
### High-level commands (porcelain)
* git-hawser-config(1):
* git-lfs-config(1):
Display the Git Media environment.
* git-hawser-init(1):
* git-lfs-init(1):
Ensure Git Media is configured properly.
* git-hawser-logs(1):
Show errors from the git-hawser command.
* git-hawser-path(1):
* git-lfs-logs(1):
Show errors from the git-lfs command.
* git-lfs-path(1):
View and modify Git Media paths in Git attributes.
* git-hawser-push(1):
* git-lfs-push(1):
Push queued large files to the Git Media endpoint.
### Low level commands (plumbing)
* git-hawser-clean(1):
* git-lfs-clean(1):
Git clean filter that converts large files to pointers.
* git-hawser-smudge(1):
* git-lfs-smudge(1):
Git smudge filter that converts pointer in blobs to the actual content.

@ -1,16 +1,16 @@
# Hawser Specification
# Git LFS Specification
This is a general guide for Hawser clients. Typically it should be
implemented by a command line `git-hawser` tool, but the details may be useful
This is a general guide for Git LFS clients. Typically it should be
implemented by a command line `git-lfs` tool, but the details may be useful
for other tools.
## The Pointer
The core Hawser idea is that instead of writing large blobs to a Git repository,
The core Git LFS idea is that instead of writing large blobs to a Git repository,
only a pointer file is written.
```
version https://hawser.github.com/spec/v1
version https://git-lfs.github.com/spec/v1
oid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393
size 12345
(ending \n)
@ -24,7 +24,7 @@ translate to the same Git blob OID. This means:
* Use properties "version", "oid", and "size" in that order.
* Separate the property from its value with a single space.
* Oid has a "sha256:" prefix. No other hashing methods are currently supported
for Hawser oids.
for Git LFS oids.
* Size is in bytes.
Note: Earlier versions only contained the OID, with a `# comment` above it.
@ -47,38 +47,38 @@ generated from the SHA-256 signature of the file's contents.
## The Server
Hawser needs a URL endpoint to talk to a remote server. A Git repository
can have different hawser endpoints for different remotes. Here is the list
Git LFS needs a URL endpoint to talk to a remote server. A Git repository
can have different Git LFS endpoints for different remotes. Here is the list
of rules that Git Media uses to determine a repository's Git Media server:
1. The `hawser.url` string.
2. The `remote.{name}.hawser` string.
1. The `lfs.url` string.
2. The `remote.{name}.lfs` string.
3. Append `/info/media` to the remote URL. Only works with HTTPS URLs.
Here's a sample Git config file with the optional remote and hawser configuration
options:
Here's a sample Git config file with the optional remote and Git LFS
configuration options:
```
[core]
repositoryformatversion = 0
[hawser]
[lfs]
endpoint = "https://github.com/github/assets-team/info/media"
[remote "origin"]
url = https://github.com/github/assets-team
fetch = +refs/heads/*:refs/remotes/origin/*
hawser = "https://github.com/github/assets-team/info/media"
lfs = "https://github.com/github/assets-team/info/media"
```
Hawser uses `git credential` to fetch credentials for HTTPS requests. Setup
Git LFS uses `git credential` to fetch credentials for HTTPS requests. Setup
a credential cache helper to save passwords for future users.
## Intercepting Git
Hawser uses the `clean` and `smudge` filters to decide which files use
Hawser. The global filters can be set up with `git hawser init`:
Git LFS uses the `clean` and `smudge` filters to decide which files use it. The
global filters can be set up with `git lfs init`:
```
$ git hawser init
$ git lfs init
```
The `clean` filter runs as files are added to repositories. Git sends the
@ -87,15 +87,15 @@ to Git as STDOUT.
* Stream binary content from STDIN to a temp file, while calculating its SHA-256
signature.
* Check for the file at `.git/hawser/objects/{OID}`.
* Check for the file at `.git/lfs/objects/{OID}`.
* If it does not exist:
* Queue the OID to be uploaded.
* Move the temp file to `.git/hawser/objects/{OID}`.
* Move the temp file to `.git/lfs/objects/{OID}`.
* Delete the temp file.
* Write the pointer file to STDOUT.
Note that the `clean` filter does not push the file to the server. Use the
`git hawser sync` command to do that.
`git lfs sync` command to do that.
The `smudge` filter runs as files are being checked out from the Git repository
to the working directory. Git sends the content of the Git blob as STDIN, and
@ -103,7 +103,7 @@ expects the content to write to the working directory as STDOUT.
* Read 100 bytes.
* If the content is ASCII and matches the pointer file format:
* Look for the file in `.git/hawser/objects/{OID}`.
* Look for the file in `.git/lfs/objects/{OID}`.
* If it's not there, download it from the server.
* Read its contents to STDOUT
* Otherwise, simply pass the STDIN out through STDOUT.
@ -113,8 +113,8 @@ runs all mp3 and zip files through Git Media:
```
$ cat .gitattributes
*.mp3 filter=hawser -crlf
*.zip filter=hawser -crlf
*.mp3 filter=lfs -crlf
*.zip filter=lfs -crlf
```
Use the `git hawser path` command to view and add to `.gitattributes`.
Use the `git lfs path` command to view and add to `.gitattributes`.

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"bytes"

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"encoding/json"
@ -29,7 +29,7 @@ func TestDownload(t *testing.T) {
w.Write([]byte("test"))
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
reader, size, wErr := Download("whatever/oid")
if wErr != nil {
t.Fatalf("unexpected error: %s", wErr)
@ -100,7 +100,7 @@ func TestDownloadFromMeta(t *testing.T) {
w.Write([]byte("test"))
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
reader, size, wErr := Download("whatever/oid")
if wErr != nil {
t.Fatalf("unexpected error: %s", wErr)
@ -152,7 +152,7 @@ func TestDownloadWithRedirect(t *testing.T) {
w.Write([]byte("test"))
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
reader, size, wErr := Download("whatever/oid")
if wErr != nil {
t.Fatalf("unexpected error: %s", wErr)

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"io/ioutil"
@ -29,7 +29,7 @@ func TestDownloadWithMediaHeader(t *testing.T) {
w.Write([]byte("--download-header\ntest"))
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
reader, size, wErr := Download("whatever/oid")
if wErr != nil {
t.Fatalf("unexpected error: %s", wErr)
@ -76,7 +76,7 @@ func TestPut(t *testing.T) {
w.WriteHeader(200)
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
oidPath := filepath.Join(tmp, "oid")
if err := ioutil.WriteFile(oidPath, []byte("test"), 0744); err != nil {
t.Fatalf("Unable to write oid file: %s", err)
@ -103,7 +103,7 @@ func TestOptions(t *testing.T) {
w.WriteHeader(200)
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
oidPath := filepath.Join(tmp, "oid")
if err := ioutil.WriteFile(oidPath, []byte("test"), 0744); err != nil {
t.Fatalf("Unable to write oid file: %s", err)

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"encoding/json"
@ -22,7 +22,7 @@ func TestExternalPut(t *testing.T) {
defer server.Close()
defer os.RemoveAll(tmp)
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
oidPath := filepath.Join(tmp, "oid")
if err := ioutil.WriteFile(oidPath, []byte("test"), 0744); err != nil {
t.Fatalf("Unable to write oid file: %s", err)
@ -161,7 +161,7 @@ func TestPost(t *testing.T) {
}`))
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
oidPath := filepath.Join(tmp, "oid")
if err := ioutil.WriteFile(oidPath, []byte("test"), 0744); err != nil {
t.Fatalf("Unable to write oid file: %s", err)
@ -207,7 +207,7 @@ func TestPost(t *testing.T) {
}
func tempdir(t *testing.T) string {
dir, err := ioutil.TempDir("", "hawser-test-hawser")
dir, err := ioutil.TempDir("", "git-lfs-test")
if err != nil {
t.Fatalf("Error getting temp dir: %s", err)
}

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"encoding/json"
@ -125,7 +125,7 @@ func TestUploadWithVerify(t *testing.T) {
w.WriteHeader(200)
})
Config.SetConfig("hawser.url", server.URL+"/media")
Config.SetConfig("lfs.url", server.URL+"/media")
oidPath := filepath.Join(tmp, "oid")
if err := ioutil.WriteFile(oidPath, []byte("test"), 0744); err != nil {
t.Fatalf("Unable to write oid file: %s", err)

@ -1,8 +1,8 @@
package hawser
package lfs
import (
"fmt"
"github.com/hawser/git-hawser/git"
"github.com/github/git-lfs/git"
"net/http"
"net/url"
"os"
@ -36,7 +36,7 @@ func NewConfig() *Configuration {
}
func (c *Configuration) Endpoint() string {
if url, ok := c.GitConfig("hawser.url"); ok {
if url, ok := c.GitConfig("lfs.url"); ok {
return url
}
@ -54,7 +54,7 @@ func (c *Configuration) RemoteEndpoint(remote string) string {
remote = defaultRemote
}
if url, ok := c.GitConfig("remote." + remote + ".hawser"); ok {
if url, ok := c.GitConfig("remote." + remote + ".lfs"); ok {
return url
}

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"github.com/bmizerany/assert"
@ -7,7 +7,7 @@ import (
func TestEndpointDefaultsToOrigin(t *testing.T) {
config := &Configuration{
gitConfig: map[string]string{"remote.origin.hawser": "abc"},
gitConfig: map[string]string{"remote.origin.lfs": "abc"},
remotes: []string{},
}
@ -17,8 +17,8 @@ func TestEndpointDefaultsToOrigin(t *testing.T) {
func TestEndpointOverridesOrigin(t *testing.T) {
config := &Configuration{
gitConfig: map[string]string{
"hawser.url": "abc",
"remote.origin.hawser": "def",
"lfs.url": "abc",
"remote.origin.lfs": "def",
},
remotes: []string{},
}
@ -29,8 +29,8 @@ func TestEndpointOverridesOrigin(t *testing.T) {
func TestEndpointNoOverrideDefaultRemote(t *testing.T) {
config := &Configuration{
gitConfig: map[string]string{
"remote.origin.hawser": "abc",
"remote.other.hawser": "def",
"remote.origin.lfs": "abc",
"remote.other.lfs": "def",
},
remotes: []string{},
}
@ -41,8 +41,8 @@ func TestEndpointNoOverrideDefaultRemote(t *testing.T) {
func TestEndpointUseAlternateRemote(t *testing.T) {
config := &Configuration{
gitConfig: map[string]string{
"remote.origin.hawser": "abc",
"remote.other.hawser": "def",
"remote.origin.lfs": "abc",
"remote.other.lfs": "def",
},
remotes: []string{},
}
@ -116,7 +116,7 @@ func TestObjectUrl(t *testing.T) {
}
for endpoint, expected := range tests {
Config.SetConfig("hawser.url", endpoint)
Config.SetConfig("lfs.url", endpoint)
assert.Equal(t, expected, Config.ObjectUrl(oid).String())
}
}

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"bytes"
@ -43,7 +43,7 @@ func NewCommand(input Creds, subCommand string) *CredentialCmd {
process is the process that fires up the daemon, it will wait forever
(until the daemon exits, really) trying to read from stderr.
See https://github.com/hawser/git-hawser/issues/117 for more details.
See https://github.com/github/git-lfs/issues/117 for more details.
*/
return &CredentialCmd{buf1, subCommand, cmd}

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"encoding/base64"

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"fmt"

@ -1,8 +1,8 @@
package hawser
package lfs
import (
"fmt"
"github.com/hawser/git-hawser/git"
"github.com/github/git-lfs/git"
"github.com/rubyist/tracerx"
"io/ioutil"
"os"
@ -15,7 +15,7 @@ const Version = "0.4.1"
var (
LargeSizeThreshold = 5 * 1024 * 1024
TempDir = filepath.Join(os.TempDir(), "hawser")
TempDir = filepath.Join(os.TempDir(), "git-lfs")
UserAgent string
LocalWorkingDir string
LocalGitDir string
@ -75,13 +75,13 @@ func init() {
var err error
tracerx.DefaultKey = "GIT"
tracerx.Prefix = "trace hawser: "
tracerx.Prefix = "trace git-lfs: "
LocalWorkingDir, LocalGitDir, err = resolveGitDir()
if err == nil {
LocalMediaDir = filepath.Join(LocalGitDir, "hawser", "objects")
LocalMediaDir = filepath.Join(LocalGitDir, "lfs", "objects")
LocalLogDir = filepath.Join(LocalMediaDir, "logs")
TempDir = filepath.Join(LocalGitDir, "hawser", "tmp")
TempDir = filepath.Join(LocalGitDir, "lfs", "tmp")
if err := os.MkdirAll(LocalMediaDir, 0744); err != nil {
panic(fmt.Errorf("Error trying to create objects directory in '%s': %s", LocalMediaDir, err))
@ -102,7 +102,7 @@ func init() {
gitVersion = "unknown"
}
UserAgent = fmt.Sprintf("git-hawser/%s (GitHub; %s %s; git %s; go %s)", Version,
UserAgent = fmt.Sprintf("git-lfs/%s (GitHub; %s %s; git %s; go %s)", Version,
runtime.GOOS,
runtime.GOARCH,
strings.Replace(gitVersion, "git version ", "", 1),

@ -1,4 +1,4 @@
package hawser
package lfs
import (
"crypto/tls"

Some files were not shown because too many files have changed in this diff Show More