resulgit 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/resulgit.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resulgit",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A powerful CLI tool for version control system operations - clone, commit, push, pull, merge, branch management, and more",
5
5
  "main": "resulgit.js",
6
6
  "bin": {
package/resulgit.js CHANGED
@@ -991,6 +991,14 @@ async function fetchRemoteSnapshot(server, repo, branch, token) {
991
991
  if (branch) url.searchParams.set('branch', branch)
992
992
  const res = await fetch(url.toString(), { headers })
993
993
  if (!res.ok) {
994
+ // For new/empty repos, return empty snapshot instead of throwing
995
+ if (res.status === 404 || res.status === 500) {
996
+ // Check if this is a "new repo" scenario
997
+ const text = await res.text()
998
+ if (text.includes('not found') || text.includes('empty') || text.includes('no commits') || res.status === 500) {
999
+ return { files: {}, commitId: '' }
1000
+ }
1001
+ }
994
1002
  const text = await res.text()
995
1003
  throw new Error(text || 'snapshot failed')
996
1004
  }
@@ -2346,7 +2354,7 @@ async function cmdInit(opts) {
2346
2354
  name: repo,
2347
2355
  description: opts.description || '',
2348
2356
  visibility: opts.visibility || 'private',
2349
- initializeWithReadme: false
2357
+ initializeWithReadme: true
2350
2358
  }, token)
2351
2359
  // Use the ID returned by the server (could be numeric or string)
2352
2360
  repoId = String(createRes.id || repo)