bomanimc / gitrocket

A rocket ship that launches in your Hyper terminal when you push code with Git.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Animation launching when it shouldn't

unaipme opened this issue · comments

Just tried it out and found out that the animation also starts when I type the command nano .gitignore. Probably just some problem with the way it checks the command text or output or whatever.

Anyway, fun one! Keep it up.

Hi @unaipme! Thanks for leaving the issue!

I can't seem to repro using 1.4.2 on macOS 10.12.2. The regex that checks new lines is written here. Testing this regex with nano .gitignore seems to result in a false. Can you talk a bit about what system your using and what version of Hyper it is?

I use Hyper with a Windows 10 (x64) laptop I use at work, so now being Sunday morning, I won't be able to recreate it until 24 hours from now at least. But I think the problem is that the regex checks all the output of the session. What I mean is that if I open a tab on Hyper and make a push, the next commands I write will also trigger the animation. This seemed to stop when I typed cls, which clears the screen.

Anyway, will confirm tomorrow asap.

I'm using Hyper with "Bash on Ubuntu on Windows" instead of using it with cmd, but I don't think that makes any difference. Below is a screenshot that shows the history of commands. The animation fired after command git push gitlab master (so far so good) and after exiting from nano both times I run it.

Also, I must say that after the screenshot was taken I tried running nano on a file other than .gitignore, and when exiting the animation fired again, which makes me think that the issue may have to do with the way the output is "rewritten" on Hyper after exiting nano. Nevermind my guesses on my previous comment.

captura

What do you think?

I am able to reproduce the same problem as @unaipme, and with a similar setup (WSL/HyperJs).
Hyper version 1.4.8.

  1. Change and commit file X
  2. Git push
  3. Rocket fire as expected
  4. Open file X in nano
  5. Exit nano (no changes made)
  6. Rocket fire again

Repeating step 4 and 5 will trigger the rocket every time. It does not have to be the same file, just open any file and close nano will trigger the animation.

clear will stop this behaviour until another git push is run.

Other than that, this plugin makes me smile every time I push :)

Currently on Ubuntu 17.04 with Hyper 1.4.8. and the rocket fires everytime I switch tabs on hyper.

I am seeing this too. Happens sometimes after I do git status and git commit. Seems to only do it after I push at least once in the session. I am on Windows 10 using cmd as the shell. Could it be detecting the old push and triggering the command when the screen updates?

It's hard to pinpoint the problem but looks like after you git push for the first time in a session (or after the rocket goes off for the first time), the rocket get triggered for a lot of different actions (switching tab, existing nano or vi, git log...).
I also use WSL, Hyper 1.4.8 and gitrocket 1.0.5

Currently on macOS 10.13.1 with Hyper 1.4.8. and the rocket fires every time I switch tabs on hyper.

Plugins:
hypercwd (1.2.1),
hyperlinks (0.5.0),
hyper-spotify (3.1.1),
gitrocket (1.0.5),
hyper-sync-settings (2.0.2),
hyperterm-cursor (0.0.3),
htyt (0.1.2),
hyperterm-alternatescroll (1.3.0),
hyper-tabs-enhanced (0.4.2),
hyperterm-visor (0.3.4),
hyperterm-tinycursor (1.0.1),
hyperterm-tabs (1.3.5)

Hi all. Sorry for the late response here. Work has pulled my time quite far away from OSS.

I think the hypothesis that @unaipme has about the output being re-written (and thus triggering the animation) seems very feasible. I'll have to look into ways that it might be possible to get around this, but any help would be much appreciated!

Working on a solution now. I logged what detectPushCommand was getting as data, and as @unaipme guessed, it's getting the re-written output in the function (image of console log below). I'm trying to think of a way to solve this with component state, but I'm not sure that will work.

rocketerrorlog

After investigating I found a solution.

Below is a normal push along with the length of the data that the detectPushCommand gets passed.

gitrocketregularpushlength

Note the length is 352. I've found most of mine are around 300 in length.

Now this next image will show the length of the data when the console is re-writing previous output.

gitrocketoutputpushnotregular

The length of 2000 was about average in my testing. I've made a PR with a fix, simply adding a check that the data length is less than 1000. I made it higher than my average push to account for longer file paths.

Merged on @joshpcausey’s PR and I’ll update NPM with the new version later today.

Launched in version 1.0.6 on NPM. Thanks so much @joshpcausey for your help!