Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Bad patch when unstaging a symlink creation at a path that used to be a file #1762

Open
@smashwilson

Description

@smashwilson

To reproduce, in a git repository:

echo "something" > the-file.txt
git add the-file.txt
git commit -m "a commit"

rm the-file.txt
touch target.txt
ln -s target.txt the-file.txt
git add the-file.txt

Now open Atom in the repository, view the staged changes for the-file.txt, and attempt to unstage just the symlink creation.

I've already written a (currently skipped) test for this situation:

it.skip('may unstage the symlink creation but not the content deletion', async function() {
getPatchItem('staged', 'sample.js').find('.github-FilePatchView-metaControls button').simulate('click');
await clickFileInGitTab('unstaged', 'sample.js');
await patchContent(
'unstaged', 'sample.js',
['const quicksort = function() {', 'deleted', 'selected'],
[' const sort = function(items) {', 'deleted', 'selected'],
[' if (items.length <= 1) { return items; }', 'deleted', 'selected'],
[' let pivot = items.shift(), current, left = [], right = [];', 'deleted', 'selected'],
[' while (items.length > 0) {', 'deleted', 'selected'],
[' current = items.shift();', 'deleted', 'selected'],
[' current < pivot ? left.push(current) : right.push(current);', 'deleted', 'selected'],
[' }', 'deleted', 'selected'],
[' return sort(left).concat(pivot).concat(sort(right));', 'deleted', 'selected'],
[' };', 'deleted', 'selected'],
['', 'deleted', 'selected'],
[' return sort(Array.apply(this, arguments));', 'deleted', 'selected'],
['};', 'deleted', 'selected'],
);
assert.isTrue(getPatchItem('unstaged', 'sample.js').find('.github-FilePatchView-metaTitle').exists());
});
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    papercutSmall-scope issues and bugs we can use to backfill our sprint plans

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions