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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

New file marked as 'Copied'

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

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 Jun 01, 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.

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

Mikael Sandberg Community Leader Jan 22, 2018

No, it is all controlled by git.

sgreenup Atlassian Team Dec 04, 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 Eli_Dzamesi likes this

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

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
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,785 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you