Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-21314

Viewing the history of a file that contains non-ASCII characters in its name or path shows an error

    XMLWordPrintable

Details

    Description

      Issue Summary

      If a repository file contains non-ASCII characters in its name, or if it exists in a directory with non-ASCII characters, its history is not visible in the Source page of a repo.

      Steps to Reproduce

      1. Create a repository in Bitbucket Cloud and clone it
      2. In the clone of this repo, either create a file with non-ASCII characters in its name, e.g. τεστ.txt, or create a directory with non-ASCII characters and then a file with ASCII characters, e.g. τεστ/myFile.txt
      3. Add and commit the changes
      4. Make some changes in the file of step 2, add and commit them
      5. Push these two commits in the Bitbucket repo
      6. Open the repository in Bitbucket website and go to its Source page
      7. Select the file you created in step 2 to view its source code
      8. While viewing the file, try both of the folloiwng actions:
        (a) Right above the content of the file, there is a dropdown with the text Source. Select that, and switch to History
        (b) Right above the content of the file, there is a dropdown showing the last commit that changed this file. Select this.

      Expected Results

      (a) Selecting History should show a list of commits that changed this file:

      (b) Selecting the last commit that changes this file should also show the commit history, like below:

      Actual Results

      (a) Selecting History shows the error

      No commits available
      Having trouble showing file history
      Normally, you'd see this file's commit history, but something didn't go right.

      (b) Selecting the dropdown that shows the last commit that changed this file, doesn't show any previous commits that changed this file:

      Workaround

      (1) One option is to rename the directory/file name with the git mv command, and use a name with ASCII characters.
      However, doing so will not preserve the history of the file.

      (2) Another option that will preserve file history is to use git filter-branch in order to rename the directory/file name with non-ASCII characters, and use a name with ASCII characters.

      Please note that this will rewrite history in the repo, so the commit hashes will change.

      The following commands can be used for changing the file name and directory name respectively in a clone of the repo, adn then the changes will need to be force pushed to Bitbucket:

      git filter-branch --tree-filter '
      if [ -f "<old name>" ]; then
      mv "<old name>" "<new name>"
      fi' --force HEAD

      git filter-branch --tree-filter '
      if [ -d <old name> ]; then
      mv "<old name>" "<new name>"
      fi' --force HEAD

      Attachments

        Activity

          People

            Unassigned Unassigned
            tboudale Theodora Boudale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: