Commit Graph

70 Commits (devel)
 

Author SHA1 Message Date
Dave Musicant / thinkpad 4b80c397da Removed the -u. It conflicts with -A (--all), and appears to be unnecessary as the documentation indicates for git 2.0 indicates that -A will remove anyway. Test script confirms. 6 years ago
Nevik Rehnel c0408ff8f1 Add '-u' switch to git-add invocation. Closes #25 9 years ago
Nevik Rehnel 750e534490 Fix usage help text (typos, outdated events variable) 10 years ago
Nevik Rehnel 0b729ad582 Quote events list in command generation 10 years ago
Nevik Rehnel cd40a3f579 Update copyright notice, add Phil Thompson @philt to contributors list 10 years ago
Nevik Rehnel 56fcd4f824 Merge branch 'philt/testing' into 'testing' 10 years ago
Phil Thompson bd159dbb6e alternative to process substitution plus other multiplatform fixes 10 years ago
Phil Thompson 429c4af5bf add optional arg to specify events to monitor 10 years ago
Nevik Rehnel a2b78e9a60 Add `--all` to `git-add` call (dirs)
The call to `git add` for directories previously used the argument `.` while
being in the target directory. In current Git versions, this produces a warning
about the upcoming changes to `git add` behavior.

To remove this warning and make `git add` behave like we want it, now and in
coming Git versions, we added the `--all` switch to the call (as suggested in
the aforementioned warning). This will include removals as well as additions in
the index.
11 years ago
Nevik Rehnel 930d1d1957 Add some more comments 11 years ago
Nevik Rehnel 7788b7cbfd Only use one inotifywait instance, fix quoting
As detailed in #14, this improves usage of inotifywait: instead of calling inw
once per loop-run, it is launched once and its output piped into this script.
To facilitate this in an economic manner, a sleep period after a captured event
is added (it acts exactly as it did before this change). Should new events
occur while a waiting period is already running, that sleep process is killed
and a new one started. This groups together rapid events. The -s switch keeps
its functionality.

As mentioned in the issue, a big credit goes out to @datag, since the idea and
structure for this feature are taken from
datag/confcan@bcff79bc77.

Also fixes quoting (and quote-parsing) issues in a few places. These became
apparent in the inotifywait call (which is prepared as a string, from which
quotes arguments are not processed like normal unless `eval` is used). Testing
revealed a few quoting weaknesses in other places, where a path containing
whitespace would cause errors. Most of these should be fixed for now.

Closes #14.
11 years ago
Nevik Rehnel 72090b30ee Add help about env vars for binaries 11 years ago
Nevik Rehnel f7a992e379 Construct push command only once
Move checking and construction of push command out of main loop so construction
is only done once (push command does not change during script execution.
11 years ago
Nevik Rehnel b3fc585539 Move echo'ing of errors to function 11 years ago
Nevik Rehnel 0584887db2 Replace literal git/inw calls with vars 11 years ago
Nevik Rehnel 906fa643d5 Improve formatting of commit msg 11 years ago
Nevik Rehnel 2b71984c55 Fix -b switch to affect used remote branch
Due to the usage of the branch argument (customizable by the -b switch) in the
push command, the <branch> argument previously would push from the so-named
local branch. Since all commits happen on the currently active branch (if any),
that doesn't make much sense, since any branch other than the checked-out one
will probably not get any changes. The effect of the -b switch is thus changed
to the following:
If a branch is checked out (repo is not in a detached HEAD state), the push
command used is `git push <branch> <current branch>:<branch>`, pushing from the
currently checked-out branch to the named remote branch.
If no branch is checked out (repo is in detached HEAD state), the push command
used is `git push <remote> <branch>` (this is in fact unchanged from before).

Closes #15.
11 years ago
Nevik Rehnel b0941a2678 Add option to customize commit message
The commit message used by gitwatch can now be customized without having to
touch the code of the script. The new -m switch can be used for this, followed
by the commit message "template"; upon commit, all occurences of %d in that
templace string will be replaced by the formatted date/time (see also the -d
switch).
Closes #8.
11 years ago
Nevik Rehnel 2a3ed8fdca Change construction method for commit message
Instead of having a fixed structure of PREPEND+DATE+APPEND for the commit
message, we now use a single commit message template string, in which the
placeholder %d will be replaced by the formatted date and time (if any).
This is further preparation for implementing a customizable commit message
as requested in #8.
11 years ago
Nevik Rehnel f4e77f1d04 Change option letter for push, expand help message
Change the option letter for auto-pushing after a commit from -p (for 'push') to
-r (for 'remote') since I think that makes a bit more sense.
Expand the help on auto-pushing.
11 years ago
Nevik Rehnel de21cf061d Add option to customize the timestamp format
Add a new -d switch with which to customize the format of the timestamp inserted
into the commit message.
This prepares commit message customization as mentioned in #8.
11 years ago
Nevik Rehnel 61ef92cf04 Add some more inotify events as mentioned in #13 11 years ago
Nevik Rehnel 9bfca75959 Add option to customize sleep time after a change
A new option -s N now customizes the sleep time after detecting a change to N
seconds (the parameter is directly passed into `sleep`.
Closes #7.
11 years ago
Nevik Rehnel 0e149ca1a8 Add some comments. Add @datag as contributor. 12 years ago
Nevik Rehnel 4e55eaa3ad Merge datag/gitwatch@7c34782d (testing) into testing, closing PR #11. 12 years ago
Dominik D. Geyer 7c34782d9a Provide function is_command() and check for multiple dependencies 12 years ago
Dominik D. Geyer ac999af602 Partly reverted change of 7215554b and use dirname again
- The bash string manipulation ${var%/*} behaves different to dirname,
  e.g. paths like "/" and "/foo" return empty string
- Quote argument to dirname as preparation for using whitespace in paths
12 years ago
Dominik D. Geyer 3a54d02edd Cosmetics: Be consistent with command substitution syntax 12 years ago
Dominik D. Geyer 7215554ba6 Cosmetics: Use bash string manipulation instead of basename/dirname 12 years ago
Dominik D. Geyer 7346b37a0d Test for number of script arguments to be 1 after shifting options 12 years ago
Dominik D. Geyer 9473048fdf Cosmetics: Make use of here-string instead of using piped echo 12 years ago
Dominik D. Geyer e3ca99840f Exit with code 1 and message if target is neither a regular file nor a directory 12 years ago
Dominik D. Geyer b82d406108 Cosmetics: Whitespace fix 12 years ago
Dominik D. Geyer f17e9d68c4 Cosmetics: Syntax/whitespace change 12 years ago
Dominik D. Geyer c85025d456 Prerequisites check: Test for non-zero value
Also, use alternate syntax for which-test and exit with non-zero exit
code for git-test as well.
12 years ago
Dominik D. Geyer 9f71f494eb Cosmetics: Syntax/whitespace fixes 12 years ago
Dominik D. Geyer d9fc7297e9 Cosmetics: Use bash-specific redirection
Redirect both stdout and stderr to /dev/null.
Requires bash version >= 4.
12 years ago
Dominik D. Geyer 9751094c0e Make use of /usr/bin/env in shebang 12 years ago
Nevik Rehnel 825fde087b Expand help/usage message, improving fix for #1. 12 years ago
Nevik Rehnel 95d6a4176c Add newline at end of file. Fix comment formatting (hash then space then text) 12 years ago
Nevik Rehnel 1c822907c3 Shift input arguments so code referencing first arg still works 12 years ago
Nevik Rehnel d8096cad4d Fix if conditions for auto-pushing.
After committing the changes to the repo, the script tests if the auto-push
variables are set, to see if the push should be done. The conditions for these
if branches were exactly the wrong way around. This is now fixed.
12 years ago
Nevik Rehnel 25b5f13cab Merge commit MatthewM/gitwatch@e3869ff (testing) into testing 12 years ago
Matthew McGowan e3869ffdc5 Added comments to the new code 12 years ago
Matthew McGowan 73f31173fb Fixed a typo in README.md 12 years ago
Matthew McGowan dd6e4073eb Forgot to add *~ for a backup file 12 years ago
Matthew McGowan 6a5e99bc63 Added a .gitignore 12 years ago
Nevik Rehnel 9481d7e21c Merge commit MatthewM/gitwatch@c14644f (testing) into testing 12 years ago
Matthew McGowan c14644fd3d Updated README.md to reflect the command line param changes 12 years ago
Matthew McGowan 2666870800 Added both the -p and -b options 12 years ago