diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/index-pack/main.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cmd/index-pack/main.go b/cmd/index-pack/main.go index 0715fa05..cfd80f6a 100644 --- a/cmd/index-pack/main.go +++ b/cmd/index-pack/main.go @@ -85,7 +85,7 @@ func run(repoPath, destinationPath, objectFormat string, fixThin, writeRev bool) defer func() { _ = destinationRoot.Close() }() - result, err := ingest.Ingest(os.Stdin, destinationRoot, algo, ingest.Options{ + pending, err := ingest.Ingest(os.Stdin, algo, ingest.Options{ FixThin: fixThin, WriteRev: writeRev, Base: base, @@ -95,6 +95,22 @@ func run(repoPath, destinationPath, objectFormat string, fixThin, writeRev bool) return err } + if pending.Header().ObjectCount == 0 { + discarded, err := pending.Discard() + if err != nil { + return err + } + + _, _ = fmt.Fprintf(os.Stdout, "pack\t%s\n", discarded.PackHash.String()) + + return nil + } + + result, err := pending.Continue(destinationRoot) + if err != nil { + return err + } + _, _ = fmt.Fprintf(os.Stdout, "pack\t%s\n", result.PackHash.String()) return nil |
