ku1ik / git-dude Goto Github PK
View Code? Open in Web Editor NEWGit commit notifier
Home Page: http://ku1ik.com/
License: GNU General Public License v3.0
Git commit notifier
Home Page: http://ku1ik.com/
License: GNU General Public License v3.0
Hi,
I really like the idea of reusing my already cloned repository instead of cloning them again somewhere else but I was wondering how git would handle things in case of simultaneous operations, if git-dude is doing a fetch and at the same time I am doing a pull for example.
While I am pretty sure it may well never happen I would not want to corrupt a repository by accident.
Any idea if this case would be handled gracefully by git ?
Thanks much for sharing this awesome tool.
I am struggling to get it to display any notifications though. This is on gnome, so its using notify-send which works fine otherwise. I am calling this script at boot to start dude:
watchdir=$(git config dude.watchdir)
if [ -n $watchdir ]; then
git dude $watchdir
fi
The directory where I am keeping the repos I want monitored is ~/.git-watch, which i have defined in the .gitconfig
As far as I can tell everything seems to start and run fine, as you can see in the screenshot of the relevant processes.
I am pretty much at a loss on what could be preventing the notifications from displaying. I am not using gdm or any display manager / screensaver. Is git-dude supposed to sleep if the screensaver is active and not fetch any info from git, if I am understanding correctly?
If you have any thoughts on what could be going wrong I would love to hear them.
The source file indicates that the license is GPLv2, but the LICENSE.txt file looks BSD-style. Which is it?
There are some repositories (documentation, for instance), where I am not worried about merging, and want the latest versions with me at all times. I'm thinking of something like
git config dude.automerge = master
And this would cause the master to automatically be merged. It would be even better if git-dude could detect an unclean merge, and not do it, but (possibly) warn me about it.
I'm currently getting the same "new branch ss/date]" notification every 60 seconds. Whoever created this branch quickly deleted it, but the notification continues. Is this just a parsing issue?
Would issue updates/mentions and the like activity notifications be within scope of this script to consider adding or accepting a pull request for? Not sure if it's possible just yet, but thought it would be nice to take that out of the realm of email and into desktop notifications like this does with commits/tags/..
Exactly.
If i have a repo with a parenthesis in the name the script breaks when running eval
icon_path=/home/grok/code/salt-states/icon.png
cd "$dir_name"; git rev-parse --git-dir 2>/dev/null
cd "$dir_name"; git config dude.ignore
basename "$dir_name" .git
git config dude.remote || true
git fetch $remote 2>&1 | grep -F -- '->' | sed 's/^ [+*=!-] //'
git config dude.icon || true
pwd
icon_path=/home/grok/code/salt-states\ (copy)/icon.png
/home/grok/bin/git-dude: eval: line 67: syntax error near unexpected token `('
Is it possible to run this as a daemon or is screen/tmux the best solution? (It'd be really nice if it could be added to the start up items so that it ran automagically after reboot.)
Seems like I must specify the .git-dud dir on the command line,
else I get a crash because of that [-d $1] test on line 32.
Great little function otherwise :-)
It would be cool if these notifications were linked back to github commits so we could view the commit if we were curious...
It's not needed for git fetch
and Git isn't GitHub only. :)
Any way to have it use a repo password?
(Very cool, otherwise, thank you.)
Error occurring:
fatal: ambiguous argument '+': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
Working example of a git fetch
which indicates a force-pushed branch ref in it's output:
$ git fetch
remote: Counting objects: 78, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 48 (delta 28), reused 48 (delta 28)
Unpacking objects: 100% (48/48), done.
From github.com:Username/repo
+ 83e93db...b212eee branch-name -> origin/branch-name (forced update)
Workflow:
The output of git fetch 2>&1 | grep -F -- '->' | sed -E 's/^\s+\+\s+//'
(git-dude#L71) is passed to awk
(via a case statement) multiple times, each of which assigns a column of the output to a variable used by the notifier.
Piped output from working example:
$ git fetch 2>&1 | grep -F -- '->' | sed -E 's/^\s+\+\s+//'
+ 83e93db...b212eee branch-name -> origin/branch-name (forced update)
Cause of error:
The case statement has values for new branch (git-dude#L85), new tag (git-dude#L89), and new commits (git-dude#L79). However, because ".." is also included in the output for a force-pushed branch, but not as the first column in the output, it's matched by the "new commit" case and awk
assigns an output flag to the commit_range
variable. For instance, if the output from the git fetch
above is sent to awk
(git-dude#L80) it would result in the following:
$ echo " + 83e93db...b212eee branch-name -> origin/branch-name (forced update)" | awk '{ print $1 }'
+
In the case of a force-pushed branch, a +
symbol is the first column in the output, not the abbreviated SHA-1 commit range, and thus the error. Similar issues may occur for other scenarios, such as deleted refs returned in the git fetch
output which are prefixed with a -
symbol.
Tryed several times in debian system (+openbox). Created everythink as readme says but then i enter git dude it just hangs and nothing happens. Required libraries installed. Maybe it's my fault or system ?
Pull Request #30 added support for OS X Notification Center (OS X 10.8 Mountain Lion and newer) using terminal-notifier. Unfortunately, it also added GitHub-specific support, so was not accepted, but the OS X Notification Center support would be a nice addition.
Awesome tool. Sometimes, lots of commits take place, and it will cause screen blindness.
Here is a suggestion:
Any time a file is modified in the git repo dir and is not yet checked in or not pushed, this file's full path name is added to a "watch file"
Based on an optional parameter, use "git log --stat" instead of "git log"
Grab the files names that have changed in a commit, as output from the "git log --stat"
If they match any of the files in the "watch file", then generate the alert
When the user has committed and pushed, this file name is removed from the "watch list"
This will allow for early merge warnings.
we need a simple package for this
$ npm install -g git-dude
then
$ git-dude [options e.g. recursively watch child git repos in ~/Public] [args, e.g. pwd]
In order to use git-dude in KDE environments you need to install colibri package, just for your information.
Hello. I tried adding this to my cron script so I can daemonize this git-dude:
@reboot /home/zero/.bin/git-dude 'Documents/2015-2016/Second\ Semester/CSC\ 199/Source\ Code/'
Where /home/zero/.bin/git-dude
is the location of where I stored the git-dude script and the location after it is the directory with a local repo that I want to watch/observe.
Except that it doesn't work as it is supposed to do (at startup). I tried figuring it out where the fault might be, by manually calling the command in the terminal:
1.) For @reboot
, it works perfectly fine with a simple echo "hi" > /home/zero/reboot.txt 2>&1
(which creates a .txt file in my Home dir)
2.) Calling the script by its location /home/zero/.bin/git-dude .....
instead of just git dude .....
. Works perfectly fine with this and other test repos.
3.) Enclosing the location of the repo with quotation marks/apostrophes ' '. It works with or without.
So I was wondering where the issue might be, and why it doesn't work in cron but works if the git dude command is triggered manually.
PS. Also, any other forms of daemonizing this git dude aside from cron will be very appreciated.
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.