RMMV, git, gitattributes, and versionId change

Discussion in 'Javascript/Plugin Support' started by inqs, Mar 25, 2019.

    Tags:
  1. inqs

    inqs Villager Member

    Messages:
    15
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I have my RMMV project checked into git.

    I notice that pretty much any time I do anything, git says that a bunch of files in data/*.json have changed. I fixed some of this by adding a .gitattributes file with
    Code:
    # For json files in data/ don't mess with them
    data/*.json text=false
    
    but I still see data/System.json changing all the time. It looks like there is a versionId field in there that gets bumped. That's fine but it would be everything in data/System.json is on one line so it's hard to see that. Is there a way to tell git or RMMV or something to either have line breaks in data/System.json so its easier to see what has changed or to somehow highlight that change instead of showing one gigantic diff just when that one field changes?

    Also, any tips on how to configure/use git with RMMV would be much appreciated.

    Thanks in advance
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,640
    Likes Received:
    6,579
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    you should NOT autosync your project folder to the web.

    The problem is that RMMV handles its files like a database program, which means that those files are always open as long as the editor is open.
    If a second program tries to access the same file at the same time, it will fail (because only one program can access a file at the same time), and most cloudsync programs interprets that as "empty file", effectively destroying it. A lot of people have lost their projects because of this.

    Only call a sync after the editor has been closed. I don't know if you can program that into your sync program or not - if you can't then it's better for your file safety to only make manual backups.
     
    #2
    caethyril likes this.
  3. inqs

    inqs Villager Member

    Messages:
    15
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for the help, but I'm not quite sure what you are talking about. My workflow is as follows:

    1. Edit in RMMV, save, close RMMV.
    2. Type "git status" at a cygwin prompt to see changes.
    3. Use "git commit -m" to Commit changed files into git.

    I think this is a solid workflow and if anything should protect my project and not make it risky. If you have suggestions for a better git workflow, please let me know as I'm very new to RMMV.

    My main issue is that when I type "git status" to see the changes, what I see is sometimes not so useful because of:
    1. How git handles line endings by default.
    2. How RMMV likes to put everything in the JSON file all on one line which makes changes harder to decipher.

    I dealt with issue #1 using a .gitattributes file as mentioned in my original post. I'm looking for help on #2. For example, if all RMMV has done is change the versionId field in data/System.json, it would be nice if there were an easy way to realize that with "git diff".

    Thanks in advance for any pointers on good git workflows for RMMV.
     
    #3
  4. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,626
    Likes Received:
    1,049
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @Andar That advice, while good advice, isn't relevant to this question - git isn't an autosync program it's a version control system.

    @inqs I use git in my project and I noticed the same thing - every system generated JSON file has sensible line breaks except for System.json. That would actually be a good thing to request in the MV Improvement forum section.

    I'm not 100% sure about what's possible with .gitattributes, but I don't think there's much you can do about it. I'm also not sure if you want to set the text attribute to false for those json files, otherwise it won't convert CRLF line endings to LF (unless you're on a Mac then it wouldn't matter i guess).
    You'll just have to deal with it being changes on every save I think. The "versionId" field in the System.json file is just autoincremented every time you save changes to the program, this controls whether the map is reloaded/refreshed when loading a save file.
     
    #4
    inqs likes this.
  5. cmdted

    cmdted Villager Member

    Messages:
    6
    Likes Received:
    5
    First Language:
    English
    Primarily Uses:
    RMMV
    #5
    Aloe Guvner likes this.
  6. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,970
    Likes Received:
    10,663
    First Language:
    English
    Primarily Uses:
    RMVXA
    @cmdted Just a heads up - until that thread with your suggestion is approved by Archeia, no one except you and Mods can see it.
     
    #6

Share This Page