Skip to content

Clear the file name pasteboard deprecation warnings - #589

Merged
hannesa2 merged 2 commits into
gitx:masterfrom
goneng:clear-pasteboard-type-warnings
Aug 24, 2026
Merged

hannesa2 merged 2 commits into
gitx:masterfrom
goneng:clear-pasteboard-type-warnings

Conversation

@goneng

@goneng goneng commented Aug 23, 2026 •

Copy link
Copy Markdown
Collaborator

Hand the dragged and dropped files over as file URLs, the shape that
replaced the file name property list on the pasteboard.

  • Hand the table one pasteboard writer per row, which is where a drag
    of several files gets its several items
  • Read the files dropped on the commit message as file URLs
  • Name the internal row payload after the bundle, since an item drops
    a type that is not a uniform type identifier
  • Carry that row on the same item, so a drag between the two tables
    reads the rows back off the items it was handed

The tables exchange rows through a private type, which the older
pasteboard API accepted under any name. Carried on an item it needs a
real identifier, and is dropped without one, silently and without
failing the drag.

This clears four of the seven pasteboard warnings. The three left are
NSFilesPromisePboardType in PBQLOutlineView, which need
NSFilePromiseProvider and a reworked write path, so they are better
off on their own.

Dragging a file out to the Finder moves it rather than copying it.
That is long-standing behaviour rather than anything new here, and
#592 addresses it separately.

Test plan:

  • PBGitCommitFileDragTests covers the drag from both ends: every
    dragged file reaches the receiver, each dragged row gets its own
    pasteboard item, and the rows stay readable for a drag between the
    tables
  • xcodebuild test -only-testing:GitXTests is green, 45/45
  • Checked by hand, a drag session being beyond a unit test: dragging
    one file and several files between the staged and unstaged lists,
    in both directions; dragging several files out to another editor,
    which opens all of them; dropping files on the commit message from
    inside the repository, which writes relative paths, and from
    outside it, which writes absolute ones

@goneng
goneng force-pushed the clear-pasteboard-type-warnings branch 2 times, most recently from 5b4806f to 8a95c77 Compare August 24, 2026 11:15
@goneng goneng changed the title Move the file drags onto the file URL pasteboard type Clear the file name pasteboard deprecation warnings Aug 24, 2026
@goneng
goneng marked this pull request as ready for review August 24, 2026 11:41
@goneng
goneng force-pushed the clear-pasteboard-type-warnings branch from 8a95c77 to 5fa302d Compare August 24, 2026 11:42
goneng added 2 commits August 24, 2026 14:53
Take the dropped files from the pasteboard through the file URL API
that replaced the file name property list.

- Read the drop as file URLs rather than as a list of path strings
- Skip a URL that carries no path, rather than inserting nothing

The view rewrites dropped paths to be relative to the working
directory, and that needs only the paths, so reading them as URLs
leaves what ends up in the message unchanged.
Put each dragged file on the pasteboard as its own file URL item, the
shape that replaced the single file name property list.

- Hand the table one pasteboard writer per row, which is where a drag
  of several files gets its several items
- Name the internal row payload after the bundle, since an item drops
  a type that is not a uniform type identifier
- Carry that row on the same item, so a drag between the two tables
  reads the rows back off the items it was handed

The tables exchange rows through a private type, which the older
pasteboard API accepted under any name. Carried on an item it needs a
real identifier, and is dropped without one, silently and without
failing the drag.
@goneng
goneng force-pushed the clear-pasteboard-type-warnings branch from 5fa302d to 4ebf8af Compare August 24, 2026 11:54
@hannesa2
hannesa2 merged commit 874bb74 into gitx:master Aug 24, 2026
3 checks passed
@goneng
goneng deleted the clear-pasteboard-type-warnings branch August 24, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants