Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

New file marked as 'Copied'

JS87CR June 1, 2016

I created a new file based on a existed file in my repository.  I committed the file but Stash marked as 'Copied' and not as 'Added'.

Why stash did that?

2 answers

0 votes
Tony Tony February 17, 2021

For Bitbucket Server you can increase a setting causing only very similar files to be recognized as "copied" or "moved".

plugin.bitbucket-git.diff.renames.threshold

https://confluence.atlassian.com/bitbucketserver/bitbucket-server-config-properties-776640155.html/#BitbucketServerconfigproperties-plugin.bitbucket-git.diff.renames.threshold

 

There is a similar config for Stash:

plugin.stash-scm-git.diff.renames.threshold

https://confluence.atlassian.com/display/STASH026/Stash+config+properties

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 1, 2016

Git tracks file content, not files, so in your case Git detected that the new file was very much the same as the original file and recognized it as copied. This should not affect anything.

idmatvieiev January 22, 2018

Is there any possibility to mark the file as created, to have better diffs?

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2018

No, it is all controlled by git.

sgreenup
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 4, 2018

Stash probably detected it because it might be using something similar to:

$ git diff -C ...

You'll usually see that you've copied from a similar file if you've modified the file you are "copying" from within the same commit. You can usually still see it as a new file if you run git diff locally.

Like Deleted user likes this
Phillip Baxter April 16, 2019

This is really frustrating for pull requests. When you're trying to view the new file, BitBucket thinks it's copied from another file just because all of our files start with the same header comment.

Oddly, if I limit the "Show diff of" to the commit where the file was added, it correctly detects it as a new file. But when I view "All changes in this pull request", the error occurs.

Would be nice to have a "mark as new file" or something like that.

Like # people like this
Kevin Platt December 18, 2020

I agree, this becomes a real problem because the Bitbucket diff for the Copied file only shows the DELTAS from the file it thinks it was copied from, so reviewers only look at those deltas, when they should be reviewing the entire file!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events