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

Some .gs are ignored when pushing // Diff 'undefined' #18

Open
sp-guillem-orpinell opened this issue Feb 24, 2017 · 6 comments
Open

Some .gs are ignored when pushing // Diff 'undefined' #18

sp-guillem-orpinell opened this issue Feb 24, 2017 · 6 comments
Projects

Comments

@sp-guillem-orpinell
Copy link

I have 4 files in a script, two of them called 'onOpen.gs' and 'onEdit.gs'. This 2 files are ignored by the assistant. Instead of finding the changes in this 2 files, it gets next changes:
screenshot 2017-02-24 12 44 04

I pushed the 2 files with the terminal. When pulling them from the IDE, assistant keep ignoring the existing files in the IDE and suggest me to add them as new. When accepting to add them as new, next error is thrown:
screenshot 2017-02-24 12 43 48

I've been using the assistant for a month, and it's a recurrent bug: ignoring some files and/or detecting diffs in an 'undefined' file.

@leonhartX
Copy link
Owner

leonhartX commented Feb 24, 2017

Hi, thanks for the feedback.
Can you provide a more detailed reproduction steps?
I've tried to add two files with onOpen.gs and onEdit.gs in a test repo but they all seem worked as expected.

@sp-guillem-orpinell
Copy link
Author

Thanks for your support :) I've been investigating and I think I have the bug:

When a .gs file contains a function with the same name it causes a bug. For instance:
screenshot 2017-02-27 18 43 10

@leonhartX
Copy link
Owner

hi, does it only happened when a file is named myFunction.gs?
i've managed to reproduce this when GAS IDE has a myFunction.gs file already. and seems like this file does not have a name filed which the others has in the GAS RPC response.
but there is no specification about this so i'm not sure wether this is a regular behavior.

@leonhartX
Copy link
Owner

oh, i found the cause. when a .gs file contains a function which function name(eg: doSomething()) is same as the file name(eg: doSomething.gs), the GAS RPC's response will omit the file name field(i don't know why).

so a quickly workaround is to give the file a different name from any of the function's name.

i'll continue try to solve this but the the RPC is so weird and without any document, i'm not sure it could be fixed.

@gulliverhan
Copy link

@leonhartX I think it could be helpful to identify when this issue happens, warn the user, and perhaps allow them to have the js filename to be changed automatically.

I was thinking of either using https://github.com/ariya/esprima or doing something similar to extract all of the function names in the apps script code. Then I can compare to the script file names.
If there are conflicts we can either warn the user, or just add a suffix to the script file name - I can't think of any consequences of changing the script file name?

@leonhartX
Copy link
Owner

@gulliverhan Yes, I agreed that it's better to let user knows what's going wrong.
But I think it's difficult to do the analysis work, since user could change the filename and function name anytime, if we can not provide a consistent behavior in various situation, just a warn is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
gas-hub
  
To Do
Development

No branches or pull requests

3 participants