Giter Club home page Giter Club logo

git-peek's People

Contributors

jarred-sumner avatar tsathis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-peek's Issues

macOS: problems on Big Sur (Intel) & BBEdit

So git-peek didn't work as expected with BBEdit. Config file ~/.git-peek has EDITOR=BBEdit --wait

It was working fine in iTerm, but as soon as I use the Firefox extension via the git-peek app, it failed. What I noticed was the following: the code signature of git-peek.app was broken, and it's not possible to apply a new signature, because git-peek-shim was in the wrong place within the bundle.

So I moved that file to ./Contents/MacOS/git-peek-shim, then changed its editor line to export EDITOR="BBEdit", then changed ./Contents/Resources/Scripts/main.scpt to

on open location this_URL
	try
		set innerCmd to "/Users/USER/Applications/git-peek.app/Contents/MacOS/git-peek-shim " & quoted form of this_URL & " &> /usr/local/var/log/git-peek &"
		do shell script innerCmd
	on error errMsg
		display dialog errMsg
	end try
end open location

i.e. changed the path of the variable innerCmd, whereas "USER" is substituted for my actual username, of course… then code-signed the app again, which finally worked, because git-peek-shim was now in a proper nested location. (Note: a broken signature might cause problems on Big Sur on arm64 macOS.)

Now, running git-peek via the Firefox extension opened BBEdit alright, but after the repo downloaded, it didn't show & was colored red, which in BBEdit means that a file has been deleted, in our case that the repo was deleted immediately after download.

How do I solve this problem?

git-peek via iTerm

snap1

git-peek via Firefox extension

snap2

[WSL] - Doesn't work with code-insiders

Hey great project

I just tried it out on WSL. I have code-insiders but it doesn't find it sadly.

➜  ~ which code-insiders
/mnt/c/Program Files/Microsoft VS Code Insiders/bin/code-insiders
➜  ~ git peek https://github.com/Jarred-Sumner/git-peek
⏳ Extracting repository to temp folder...
💿 Finished downloading repository!
💻 Launched editor in 1.09s
🗑  Deleted temp repo

The above opens Vim.
code-insiders is on my path so im not sure why it doesn't open it up. Im assuming its a WSL issue

Edit:
passing -e code-insiders works, is there a way to set that as the default?

Is there a reason why code is before vim but code-insiders is after? I would expect code-insiders to also be near the front. https://github.com/Jarred-Sumner/git-peek/blob/main/src/index.ts#L15
I can see you made a concious choice to push it to the end here: 8fa612e but this means it will never get picked on WSL because vim will always exist before it. Unless the user sets $EDITOR

Doesn't start on Fedora 33, ZSH, Node 14, yarn

I installed this with yarn global add @jarred/git-peek on Fedora 33 Workstation, in ZSH, Node version v14.15.4 and I get this when I run it, with or without a package name:

~: git-peek Jarred-Sumner/git-peek
/usr/bin/env: ‘node --no-warnings’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

Same happens when I install with npm install -g ... instead.

Can I do anything, is this a configuration issue on my side?

Add configuration for default $EDITOR override

I'd like to use WebStorm when running git peek, however my $EDITOR environment is set to vim and I'd prefer to keep it this way because I prefer working in the terminal when working with git for interactive rebases.

I know I currently can overcome this by writing git peek -e webstorm url however it would be nice if I could save a default editor once I set up git peek that I won't have to remember adding the flag each time

line 12: -S: command not found

C:\Users\Administrator>git peek https://github.com/jarred-sumner/git-peek
C:\Users\Administrator\AppData\Roaming\npm\git-peek: line 12: -S: command not found

Sys: Windows 10, 7

brew package

Is it possible to get a brew package published? I've never tried to cook a formula on brew before. Not sure it's even possible with Node.js and git-peek being installed globally.

Pre-compiled `brew/git-peek` bloats the repository unnecessarily

Cloning this repository is pretty expensive. git sizer says this:

$ git sizer
Processing blobs: 165
Processing trees: 121
Processing commits: 62
Matching commits to trees: 62
Processing annotated tags: 10
Processing references: 13
| Name                         | Value     | Level of concern               |
| ---------------------------- | --------- | ------------------------------ |
| Biggest objects              |           |                                |
| * Blobs                      |           |                                |
|   * Maximum size         [1] |  74.1 MiB | *******                        |

[1]  cb3591f1d9a97e7f816927a30e91c101c484091d (refs/heads/main:brew/git-peek)

A 74.1 megabyte blob... Unfortunately, this is now part of tagged releases, so it cannot easily be removed. But maybe it can be deleted from the tip revision, and a .gitignore could be installed to prevent it from being added again (I see that bbe4e91 tried to delete it but it came back nevertheless)?

[Feature Request] Configurable temp path

Great piece of software, just played with it a bit. Although git-peek nicely cleans up after closing the editor, there's potential for bringing a system down by saving to /tmp by default. On most Linux systems /tmp is mounted as tmpfs, meaning that whatever is dropped there, even temporarily, eats into RAM.

I realize that this doesn't pose (much) problems with relatively small repositories, but I wonder if there's some kind of size limit check before committing to download a huge repo. For example, what if one wants to take a quick peek at what Linus Torvalds is doing in the Linux kernel repo (+4GB)? To avoid this potential pitfall it would be nice to have a user-configurable knob to store temporary files at a different location.

Open default GH branch

git-peek seems to open the master branch, but if a repo has a non-master default branch this ends up opening the "wrong" branch, and it's not immediately obvious how to open the "correct" branch.

Take this repo as an example: https://github.com/jdiwnab/OrbitSim

  • The default branch is "gh-pages".
  • Running git-peek https://github.com/jdiwnab/OrbitSim results in the editor being opened to a very sparse repo, since git-peek is opening https://github.com/jdiwnab/OrbitSim/tree/master.
  • This experience doesn't match what we see when landing on https://github.com/jdiwnab/OrbitSim , and made me wonder if git-peek was still in the process of cloning the repo or if there was a bug.

The way to open the default branch is to run git-peek https://github.com/jdiwnab/OrbitSim/tree/gh-pages. But this is a url that needs to be constructed manually, as GH doesn't seem to expose it in the UI: the url for the gh-pages branch is just https://github.com/jdiwnab/OrbitSim

It would be nice if git-peek accepted a "branch" parameter or opened the default branch of the repo.

URL handler not opening git-peak.app

git peek works fine from the command line, but I can't get the url-handler to work. I determined it's not the Chrome extension either since the git-peek:// url doesn't trigger git-peek in Safari either.

Running an M1 Pro Max on macOS 13.0 (22A380) if that helps. Haven't been able to sort it out. 🤕

If you click it serveral times it will eventually show this:
image

brew install v npm

really cool tool, qq that the README doesn't make clear: is the brew installed version giving me the binary? or is it installing the 20% slower npm version?

Consider support to recognize repo's language to decide which editor to open

Thanks for such a cool project!

I.E.:

  • Rust: emacs
  • Go: goland
  • Java: intellij
  • CPP: vim

But this feature should not break editor search order of course, as described in help command: By default, it will search $EDITOR. If not found, it will try code, then subl, then vim. i.e.: search order: goland -> vim -> subl

My current workaround is that I currently take a look at what language is used and set a custom $EDITOR variable just before peek it: EDITOR=clion git peek https://github.com/ylukem/pin-go

rmSync is not a function

I get this stack trace on Windows:

$ git peek https://github.com/git-for-windows/git/pull/3017
 Extracting repository to temp folder...
💻 Launched editor in 0.89s
 Finished downloading repository!
🗑  Deleted temp repo
TypeError: u3.default.rmSync is not a function
    at uE (C:\Users\me\AppData\Roaming\npm\node_modules\@jarred\git-peek\bin\git-peek:497:846)
    at s3.run (C:\Users\me\AppData\Roaming\npm\node_modules\@jarred\git-peek\bin\git-peek:528:2695)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
TypeError: u3.default.rmSync is not a function
    at uE (C:\Users\me\AppData\Roaming\npm\node_modules\@jarred\git-peek\bin\git-peek:497:846)
    at s3.run (C:\Users\me\AppData\Roaming\npm\node_modules\@jarred\git-peek\bin\git-peek:528:2695)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

That's with

$ node -v
v12.16.2

Is it possible that

fs.rmSync(instance.destination, {
should use await fs.promises.rm() instead (of course, doExit() would then have become async and all the call sites, including this one would have to be adjusted).

Doesn't work with code-insiders

(base) ➜  ~ git peek https://github.com/Jarred-Sumner/git-peek -e code-insiders
💻 Launched editor in 0.16s
⏳ Extracting repository to temp folder...
🗑  Deleted temp repo

On macOS 11.1

Looks fine, but vscode launches like this

image

(base) ➜  ~ which code-insiders
/usr/local/bin/code-insiders
(base) ➜  ~ code-insiders --version
1.54.0-insider
afd102cbd2e17305a510701d7fd963ec2528e4ea
x64
(base) ➜  ~

No problems so far in vim

VS Code does not open on Windows

Node v12.18.4
NPM 6.14.6
Windows 10

λ git-peek.cmd https://github.com/webrtc/samples.git
� Launched editor in 0.26s
Error: Command failed: /c/Users/JamesCote/AppData/Local/Programs/Microsoft VS Code/bin/code --wait "C:\Users\JAMESC~1\AppData\Local\Temp\tmp-10752-xVz6CmmhvAv0" --new-window -g "C:\Users\JAMESC~1\AppData\Local\Temp\tmp-10752-xVz6CmmhvAv0\README.md":0:0
The system cannot find the path specified.

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) 
{
  killed: false,
  code: 1,
  signal: null,
  cmd: '/c/Users/JamesCote/AppData/Local/Programs/Microsoft VS Code/bin/code 
--wait "C:\\Users\\JAMESC~1\\AppData\\Local\\Temp\\tmp-10752-xVz6CmmhvAv0" --new-window -g "C:\\Users\\JAMESC~1\\AppData\\Local\\Temp\\tmp-10752-xVz6CmmhvAv0\\README.md":0:0'
}
Error: Command failed: /c/Users/JamesCote/AppData/Local/Programs/Microsoft VS Code/bin/code --wait "C:\Users\JAMESC~1\AppData\Local\Temp\tmp-10752-xVz6CmmhvAv0" --new-window -g "C:\Users\JAMESC~1\AppData\Local\Temp\tmp-10752-xVz6CmmhvAv0\README.md":0:0
The system cannot find the path specified.

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

Bad credentials?

I just tried this at home, and it failed:

$ git peek https://github.com/git-for-windows/git/pull/3017
Failed to load pull request url: HTTP  401
 {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}

Why does it need credentials to begin with?

Folder deleted before editor is closed

Nice project! Just one (for me fatal) issue:

On Windows, with JetBrains Rider (C:\Users\<user>\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-0\203.6682.21\bin\rider64.exe) set as $env:EDITOR, the repo is deleted while it is being loaded.

I assume this is because Rider forks itself away causing git-peek to think that it has been closed.

It also leads to some Error: EPERM: operation not permitted, unlink (...) issues, likely due to Windows' file locking while they are open in Rider.

A simple fix/workaround for this might be something like a --no-delete or --no-close option.

Feature Request: Open pull request in editor

I'd like to be able to open a pull request in my editor using git peek -e code https://github.com/facebook/react/pull/20790

Reason: When I'm doing code reviews sometimes it's easier to review the code in my editor and be able to jump around the code without using Github's diff UI.

Additional info:
If you goto the above PR, fetch the last commit, then the archive should be available here https://github.com/facebook/react/archive/34501538a866d51f9ec5a486be8d34f8162ccf7f.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.