Skip to content

Commit

Permalink
fixed 2nd push (updates #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptix committed Nov 1, 2015
1 parent 491ba32 commit 3b00f7f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion list.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func listIterateRefs(forPush bool) error {
return errgo.Notef(err, "walk(%s) cat close failed", p)
}
sha1 := strings.TrimSpace(string(data))
refName := strings.TrimPrefix(p, ipfsRepoPath)
refName := strings.TrimPrefix(p, ipfsRepoPath+"/")
ref2hash[refName] = sha1
log.WithField("refMap", ref2hash).Debug("ref2hash map updated")
}
Expand Down
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (

"github.com/cryptix/git-remote-ipfs/internal/path"

"github.com/cryptix/git-remote-ipfs/Godeps/_workspace/src/github.com/cryptix/go/debug"
"github.com/cryptix/git-remote-ipfs/Godeps/_workspace/src/github.com/cryptix/go/logging"
"github.com/cryptix/git-remote-ipfs/Godeps/_workspace/src/github.com/ipfs/go-ipfs-shell"
"github.com/cryptix/git-remote-ipfs/Godeps/_workspace/src/gopkg.in/errgo.v1"
Expand Down Expand Up @@ -127,9 +126,9 @@ func main() {
// speakGit acts like a git-remote-helper
// see this for more: https://www.kernel.org/pub/software/scm/git/docs/gitremote-helpers.html
func speakGit(r io.Reader, w io.Writer) error {
debugLog := logging.Logger("git")
r = debug.NewReadLogrus(debugLog, r)
w = debug.NewWriteLogrus(debugLog, w)
//debugLog := logging.Logger("git")
//r = debug.NewReadLogrus(debugLog, r)
//w = debug.NewWriteLogrus(debugLog, w)
scanner := bufio.NewScanner(r)
for scanner.Scan() {
text := scanner.Text()
Expand Down
2 changes: 1 addition & 1 deletion push.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func push(src, dst string) error {
}
h, ok := ref2hash[dst]
if !ok {
return errgo.Newf("writeRef: ref2hash entry missing: %s", dst)
return errgo.Newf("writeRef: ref2hash entry missing: %s %+v", dst, ref2hash)
}
isFF := gitIsAncestor(h, srcSha1)
if isFF != nil && !force {
Expand Down
2 changes: 1 addition & 1 deletion push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestPush_twice(t *testing.T) {
"hello.txt": "e2839ad2e47386d342038958fba941fc78e3780e",
"notes": "32ed91604b272860ec911fc2bf4ae631b7900aa8",
"newFile": "cc7aae22f2d4301b6006e5f26e28b63579b61072",
"2ndNewFile": "cc7aae22f2d4301b6006e5f26e28b63579b61072",
"2ndNewFile": "bacbe054a5fc6654bac497e36b474cd6839e3616",
}
rmDir(t, cloneAndCheckout(t, nextURL, expectedClone))
}

0 comments on commit 3b00f7f

Please sign in to comment.