turfptax / ugit

Micropython OTA update from github
GNU General Public License v3.0
136 stars 24 forks source link

ugit appears not to honor ignore_files #16

Open jouellnyc opened 1 year ago

jouellnyc commented 1 year ago

Howdy. Really liking ugit.

I have found the following behavior.

If I set my ignore_files to use fqdn like [ '/save/my_file.py' ] ugit will not ignore the file as it does not match github tree path (which would be 'save/my_file.py'.

If I set my ignore_files to use the shorter syntax: [ 'save/my_file.py' ] ugit seems to ignore the files OK but then deletes it at the end under:

# delete files not in Github tree
  if len(internal_tree) > 0:
      print(internal_tree, ' leftover!')
      for i in internal_tree:
          os.remove(i)
          log.append(i + ' removed from int mem')

I don't really have logs to share. I believe my analysis is correct , but am still getting acquainted with ugit.

Happy to help w/more data.

turfptax commented 1 year ago

ugit does honor the ignore_files array by running: 'remove_ignore()'

"""def remove_ignore(internal_tree,ignore=ignore): clean_tree = [] int_tree = [] for i in internal_tree: int_tree.append(i[0]) for i in int_tree: if i not in ignore: clean_tree.append(i) return(clean_tree)"""

The function is called in pull_all """internal_tree = remove_ignore(internal_tree)"""

If you play around with ugit and change the code make sure to reboot your REPL environment and the board. There are a lot of persistent memory issues that I have run into if I don't reboot the board.

jouellnyc commented 1 year ago

OK thanks for that. For some reason I do see my excluded file being removed running ugit.pull_all(isconnected=True). Perhaps it's due to memory issues or other system issues. I'll continue to play around.

I do get decode fail try adding non-code files to .gitignore for images. Is that proper way to have ugit ignore a directory? Or would it be use of ignore_files ?

I have tried both w/o too much success, but again maybe my board is encountering hw issues.

Thanks!