resulgit 1.0.11 → 1.0.13

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 +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resulgit",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
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
@@ -1379,11 +1379,16 @@ async function cmdPush(opts) {
1379
1379
  const line = firstDiffLine(l || '', r || '')
1380
1380
  conflicts.push({ path: p, line })
1381
1381
  } else if (changedLocal && !changedRemote) {
1382
+ // Local changed, use local version
1382
1383
  if (l !== null) merged[p] = l
1383
1384
  } else if (!changedLocal && changedRemote) {
1385
+ // Remote changed, use remote version
1384
1386
  if (r !== null) merged[p] = r
1385
1387
  } else {
1386
- if (b !== null) merged[p] = b
1388
+ // No changes - include the file from whatever source has it
1389
+ if (l !== null) merged[p] = l
1390
+ else if (r !== null) merged[p] = r
1391
+ else if (b !== null) merged[p] = b
1387
1392
  }
1388
1393
  }
1389
1394
  if (conflicts.length > 0) {
@@ -1399,6 +1404,18 @@ async function cmdPush(opts) {
1399
1404
  }
1400
1405
  return
1401
1406
  }
1407
+
1408
+ // Check if there are any files to push
1409
+ if (Object.keys(merged).length === 0) {
1410
+ spinnerFail(spinner, 'Nothing to push')
1411
+ if (opts.json === 'true') {
1412
+ print({ error: 'No files to push' }, true)
1413
+ } else {
1414
+ process.stdout.write('No files to push. Add some files first.\n')
1415
+ }
1416
+ return
1417
+ }
1418
+
1402
1419
  // Execute pre-push hook
1403
1420
  spinnerUpdate(spinner, 'Running pre-push hook...')
1404
1421
  try {
@@ -1413,7 +1430,7 @@ async function cmdPush(opts) {
1413
1430
  }
1414
1431
 
1415
1432
  const body = { message: localMeta.pendingCommit?.message || (opts.message || 'Push'), files: merged, branchName: remoteMeta.branch }
1416
- spinnerUpdate(spinner, `Pushing to '${remoteMeta.branch}'...`)
1433
+ spinnerUpdate(spinner, `Pushing ${Object.keys(merged).length} file(s) to '${remoteMeta.branch}'...`)
1417
1434
  const url = new URL(`/api/repositories/${remoteMeta.repoId}/commits`, server).toString()
1418
1435
  const data = await request('POST', url, body, token)
1419
1436
  localMeta.baseCommitId = data.id || remote.commitId || ''