Skip to content

Commit

Permalink
fix rebase conflicts and ignore orig files
Browse files Browse the repository at this point in the history
  • Loading branch information
jasong689 committed Sep 28, 2022
1 parent e8e94bc commit d96a850
Show file tree
Hide file tree
Showing 6 changed files with 387 additions and 184 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tmp/*
.idea/
.DS_STORE
.envrc.local
*.orig

.vscode/*
!.vscode/settings.example.json
Expand Down
2 changes: 1 addition & 1 deletion internal/db/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func CloneToProject(ctx context.Context, tx pgx.Tx, source int64, target int64,
sql = fmt.Sprintf(`
%v
INSERT INTO dl.objects (project, start_version, stop_version, path, hash, mode, size, packed)
SELECT $%d, $%d, null, path, hash, mode, size, packed
SELECT $%d, $%d, null, path, (h1, h2)::hash, mode, size, packed
FROM changed_objects
WHERE deleted IS false
ON CONFLICT
Expand Down
8 changes: 4 additions & 4 deletions internal/db/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ func GetObjects(ctx context.Context, tx pgx.Tx, packManager *PackManager, projec
var encoded []byte
var packed bool
var deleted bool
var hash *string
var h1, h2 []byte

err := rows.Scan(&path, &mode, &size, &encoded, &packed, &deleted, &hash)
err := rows.Scan(&path, &mode, &size, &encoded, &packed, &deleted, &h1, &h2)
if err != nil {
return nil, fmt.Errorf("getObjects scan, project %v vrange %v: %w", project, vrange, err)
}
Expand Down Expand Up @@ -253,9 +253,9 @@ func GetTars(ctx context.Context, tx pgx.Tx, project int64, vrange VersionRange,
var encoded []byte
var packed bool
var deleted bool
var hash *string
var h1, h2 []byte

err := rows.Scan(&path, &mode, &size, &encoded, &packed, &deleted, &hash)
err := rows.Scan(&path, &mode, &size, &encoded, &packed, &deleted, &h1, &h2)
if err != nil {
return nil, nil, fmt.Errorf("getTars scan, project %v vrange %v: %w", project, vrange, err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/db/queryBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (qb *queryBuilder) queryWithoutRemovals() string {
%s
)
SELECT path, mode, size, bytes, packed, deleted, hash
SELECT path, mode, size, bytes, packed, deleted, (hash).h1, (hash).h2
FROM updated_objects
`

Expand All @@ -148,10 +148,10 @@ func (qb *queryBuilder) queryWithRemovals() string {
%s
)
SELECT path, mode, size, bytes, packed, deleted, hash
SELECT path, mode, size, bytes, packed, deleted, (hash).h1, (hash).h2
FROM updated_objects
UNION ALL
SELECT path, mode, size, bytes, packed, deleted, hash
SELECT path, mode, size, bytes, packed, deleted, (hash).h1, (hash).h2
FROM removed_objects
`

Expand Down
Loading

0 comments on commit d96a850

Please sign in to comment.