dsh-ide-git 0.19.2 → 0.19.4

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.
package/src/index.js CHANGED
@@ -778,6 +778,40 @@ async function log(payload) {
778
778
  const hasMore = all.length > limit
779
779
  return { repoRoot: root, commits: hasMore ? all.slice(0, limit) : all, hasMore, skip, limit }
780
780
  }
781
+ /* The merge that carried `from` INTO `to`, newest first — the anchor the
782
+ branch tree's double-click-to-browse lands on (IDEA-style: double-click
783
+ branch 2, then branch 1, and 1's list opens scrolled to the merge commit
784
+ where 2 was merged in, so "2 has been merged here" is visible at a
785
+ glance even though 1 kept moving. No merge relationship -> null, and the
786
+ caller just opens the list at the top. Pure rev arithmetic, no network. */
787
+ /* Who am I here: git config resolves user.name/email through its usual
788
+ cascade (repo-local overrides global), so the answer is per repository.
789
+ The client caches it per repo root for the whole panel lifetime — a git
790
+ identity rarely changes mid-session — and pins it to the top of the
791
+ author filter (v0.19.3), even when this branch has no commits by me:
792
+ picking it and seeing an empty list IS the answer ("I never committed
793
+ here"). Empty strings mean no identity is configured. */
794
+ async function me(payload) {
795
+ const cwd = cwdOf(payload)
796
+ const root = await repoRootOf(cwd, payload)
797
+ const name = await runGit(root, ['config', 'user.name'])
798
+ const email = await runGit(root, ['config', 'user.email'])
799
+ return {
800
+ repoRoot: root,
801
+ name: name.code === 0 ? name.stdout.trim() : '',
802
+ email: email.code === 0 ? email.stdout.trim() : '',
803
+ }
804
+ }
805
+
806
+ async function mergePoint(payload) {
807
+ const cwd = cwdOf(payload)
808
+ const root = await repoRootOf(cwd, payload)
809
+ const from = requireRef(payload.from, 'from')
810
+ const to = requireRef(payload.to, 'to')
811
+ const out = await git(root, ['rev-list', '--merges', '--ancestry-path', '--max-count=1', from + '..' + to])
812
+ const hash = out.trim().split('\n')[0] || ''
813
+ return { repoRoot: root, hash: hash === '' ? null : hash }
814
+ }
781
815
 
782
816
  async function commitDetail(payload) {
783
817
  const cwd = cwdOf(payload)
@@ -1939,6 +1973,8 @@ const METHODS = {
1939
1973
  stats,
1940
1974
  branches,
1941
1975
  log,
1976
+ me,
1977
+ 'merge-point': mergePoint,
1942
1978
  commitDetail,
1943
1979
  diff,
1944
1980
  compare,