resulgit 1.0.8 → 1.0.9

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 +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resulgit",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
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
  }