Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to "Scalar" #38

Merged
merged 8 commits into from
Aug 11, 2019
Merged

Rename to "Scalar" #38

merged 8 commits into from
Aug 11, 2019

Conversation

derrickstolee
Copy link
Contributor

@derrickstolee derrickstolee commented Aug 10, 2019

Resolves #22.

Our new name is "Scalar". This replaces as many instances of the old GVFS, gvfs, VFS for Git, VFSFORGIT, vfsforgit, etc. with "Scalar", "scalar", or "SCALAR" as appropriate.

The commits are organized as follows:

  1. [RENAME] Rename all files. This is a mechanical find and mv operation, done by a script. No blobs are changed, so --follow-renames should get exact values here, unless there are exact duplicate files in the repo. This also flattens the repo, so the old "GVFS/GVFS." pattern is now just "Scalar.".

  2. [REPLACE] Replace old name in all files. This is an attempt to automatically replace all the name strings in the contents of the files. Skips some binary file types.

The remaining commits attempt to group the reaction work required to respond to those changes.

@derrickstolee derrickstolee added this to the Demo milestone Aug 10, 2019
This should keep all blobs the same, for exact rename matches.

Here is the script used to generate these renames:

```

NEWNAME="Scalar"
LOWERNAME="scalar"

rm -rf .git
git init
git remote add origin https://github.com/microsoft/gsd

git fetch origin master
git checkout --detach
git branch -f rename origin/master
git reset --hard origin/master
git checkout rename
git clean -xdf

mv GVFS GVFS-Old
mv GVFS-Old/* .
rm -rf GVFS-Old

mv "GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset" \
   "GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/$NEWNAME.appiconset"

rename_in_directory () {
    (
        cd $1 &&
        for file in $(ls | grep "$2")
        do
            mv "$file" "$(echo "$file" | sed "s/$2/$3/g")"
        done

        for file in $(find . -maxdepth 1 -mindepth 1 -type d)
        do
            if [ "$file" != "./.git" ]
            then
                rename_in_directory "$file" "$2" "$3"
            fi
        done
    )
}

echo "Renaming"
rename_in_directory . "GVFS" "$NEWNAME"
rename_in_directory . "gvfs" "$NEWNAME"
rename_in_directory . "VFSForGit" "$NEWNAME"
rename_in_directory . "vfsforgit" "$LOWERNAME"
rename_in_directory . "VFS" "$NEWNAME"

git add .
git commit -q -s -m "[RENAME] Rename all files" -m "This should keep all blobs the same, for exact rename matches."

echo "Looking for old names:"
git ls-tree -r HEAD | grep VFS
```

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
This will change many files, and likely not build

Here is the script used to do the replacement:

```

NEWNAME="Scalar"
LOWERNAME="scalar"

for file in $(find . -type f -name '*')
    do
        if [[ $file == *.png ]]
        then
            continue
        fi
        if [[ $file == *.ico ]]
        then
            continue
        fi
        if [[ $file == *cddl1.txt ]]
        then
            continue
        fi
        if [[ $file == *.rc ]]
        then
            continue
        fi
        if [[ $file == *index_v4 ]]
        then
            continue
        fi
        if [[ $file == ./.git/* ]]
        then
            continue
        fi

        sed -i .bak "s/GVFS/$NEWNAME/g" "$file"
        sed -i .bak "s/VFS For Git/$NEWNAME/g" "$file"
        sed -i .bak "s/VFS for Git/$NEWNAME/g" "$file"
        sed -i .bak "s/VFSForGit/$NEWNAME/g" "$file"
        sed -i .bak "s/vfsforgit/$LOWERNAME/g" "$file"
        sed -i .bak "s/VFS/$NEWNAME/g" "$file"
        sed -i .bak "s/gvfs/$LOWERNAME/g" "$file"
    done

git commit -a -s -m "[REPLACE] Replace old name in all files" -m "This will change many files, and likely not build"
git clean -xdf
```

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
@derrickstolee derrickstolee marked this pull request as ready for review August 10, 2019 18:06
derrickstolee and others added 6 commits August 10, 2019 15:48
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
@derrickstolee
Copy link
Contributor Author

IT IS DONE.

@jrbriggs
Copy link
Member

I've pulled this locally and tested debug and release as well as the product installation. Works on my box!

@jrbriggs
Copy link
Member

@derrickstolee one more:

grep -rl VFS4G ./ | xargs sed -i 's/VFS4G/Scalar/g'

@derrickstolee derrickstolee merged commit dcf3e06 into microsoft:master Aug 11, 2019
@derrickstolee
Copy link
Contributor Author

@derrickstolee one more:

grep -rl VFS4G ./ | xargs sed -i 's/VFS4G/Scalar/g'

I missed this as I was preparing the merge... oops. I'll get it in a follow-up. See the message for 90e8c1b for the script I used.

derrickstolee added a commit that referenced this pull request Aug 12, 2019
When doing the rename, I converted all instances of "VFS" to "Scalar"
without first replacing the string "VFS4G". This left a bunch of
"Scalar4G" instances around the codebase. Fix that using the same
replace logic as before.

Fixes a comment from #38.
This was referenced Aug 16, 2019
derrickstolee added a commit that referenced this pull request Aug 16, 2019
This was fallout from #38.

See #64 for more discussion on the future of this setting.
@derrickstolee derrickstolee deleted the rename branch November 18, 2019 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename EVERYTHING
3 participants