From b0b79b7ace3f9d0a32dfe08d9f81fcb782e85b05 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Wed, 21 Mar 2012 22:27:53 +0100 Subject: [PATCH 01/16] Slightly improve wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fede80..d8afe89 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ examples. ## 2.1 Talks ## -People found it useful to look at slides and videos explaining how vcsh works. +Some people found it useful to look at slides and videos explaining how vcsh works. They can all be found at [here](http://richardhartmann.de/talks/). # 3 Overview -- 2.39.5 From d43e125cb172eb4b8c5c04480ad7b686e82638a5 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Mon, 26 Mar 2012 23:06:52 +0200 Subject: [PATCH 02/16] Order help alphabetically --- vcsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcsh b/vcsh index ba0049e..3937d2b 100755 --- a/vcsh +++ b/vcsh @@ -22,9 +22,9 @@ help() { clone \\ [] Clone from an existing repository - help Display this help text delete Delete an existing repository enter Enter repository; spawn new instance of \$SHELL + help Display this help text init Initialize a new repository list List all repositories list-tracked List all files tracked by vcsh -- 2.39.5 From d580f779ac853ea31b20eb6a715efad300932ad6 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Wed, 4 Apr 2012 13:41:56 +0200 Subject: [PATCH 03/16] Improve installation howto Thanks to Flavius Aspra for the Arch Linux howto --- README.md | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d8afe89..f736741 100644 --- a/README.md +++ b/README.md @@ -202,19 +202,46 @@ the template will be stored. apt-get install mr -#### 4.1.2 Clone the Template #### +#### 4.1.2 Install vcsh #### +#### 4.1.2.1 Debian #### + +If you are using Debian Squeeze, you will need to enable backports + + apt-get install vcsh + +#### 4.1.2.2 Arch Linux #### + +vcsh is availabe via [AUR](https://aur.archlinux.org/packages.php?ID=54164) + + cd /var/abs/local/ + wget https://aur.archlinux.org/packages/vc/vcsh-git/vcsh-git.tar.gz + tar xfz vcsh-git.tar.gz + cd vcsh-git + makepkg --asroot + pacman -U vcsh*.pkg.tar.xz + +#### 4.1.2.3 From source #### + +If your version of mr is older than version 1.07, make sure to put + + include = cat /usr/share/mr/vcsh + +into your .mrconfig . + + # choose a location for your checkout cd $HOME mkdir -p ~/work/git - git clone git://github.com/RichiH/vcsh.git vcsh - # make sure 'include = cat /usr/share/mr/vcsh' points to an exiting file - vim .mrconfig + git clone git://github.com/RichiH/vcsh.git cd vcsh ln -s vcsh /usr/local/bin # or add it to your PATH cd + +#### 4.1.3 Clone the Template #### + vcsh clone git://github.com/RichiH/vcsh_mr_template.git mr -#### 4.1.3 Enable Your Test Repository #### +#### 4.1.4 Enable Your Test Repository #### mv ~/.zsh ~/zsh.bak mv ~/.zshrc ~/zshrc.bak @@ -223,7 +250,7 @@ the template will be stored. cd mr up -#### 4.1.4 Set Up Your Own Repositories #### +#### 4.1.5 Set Up Your Own Repositories #### Now, it's time to edit the template config and fill it with your own remotes: -- 2.39.5 From 20e1e3ecbaadad56c0ac8678f1c1e3cc257e6d57 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Wed, 11 Apr 2012 18:45:29 +0200 Subject: [PATCH 04/16] Update docs wrt AUR --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f736741..66db110 100644 --- a/README.md +++ b/README.md @@ -213,12 +213,14 @@ If you are using Debian Squeeze, you will need to enable backports #### 4.1.2.2 Arch Linux #### vcsh is availabe via [AUR](https://aur.archlinux.org/packages.php?ID=54164) +and further documentation about the use of AUR is available +[on Arch's wiki](https://wiki.archlinux.org/index.php/Arch_User_Repository). cd /var/abs/local/ wget https://aur.archlinux.org/packages/vc/vcsh-git/vcsh-git.tar.gz tar xfz vcsh-git.tar.gz cd vcsh-git - makepkg --asroot + makepkg -s pacman -U vcsh*.pkg.tar.xz #### 4.1.2.3 From source #### -- 2.39.5 From 7f6ab9a128b7848186a9a36580011a97253f70c8 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Mon, 23 Apr 2012 23:56:39 +0200 Subject: [PATCH 05/16] Make `vcsh list` more resilient Thanks to Mathdesc for catching that one. --- vcsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcsh b/vcsh index 3937d2b..c6ea395 100755 --- a/vcsh +++ b/vcsh @@ -133,8 +133,8 @@ init() { } list() { - for i in "$VCSH_REPO_D"/*.git; do - echo $(basename "$i" .git) + for repo in "$VCSH_REPO_D"/*.git; do + [ -r "$repo" ] && echo $(basename "$repo" .git) done } -- 2.39.5 From 08d8ed6ac288e1b2c1c186eea9c33ff38edd0ac3 Mon Sep 17 00:00:00 2001 From: Valentin Haenel Date: Mon, 4 Jun 2012 16:20:38 +0200 Subject: [PATCH 06/16] don't echo the command when doing make moo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a52e9ed..cb112c7 100644 --- a/Makefile +++ b/Makefile @@ -43,4 +43,4 @@ test: if which git > /dev/null ; then :; else echo "'git' not found, exiting..."; exit 1; fi moo: - if [ -x /usr/games/cowsay ]; then /usr/games/cowsay "I hope you're happy now..."; fi + @if [ -x /usr/games/cowsay ]; then /usr/games/cowsay "I hope you're happy now..."; fi -- 2.39.5 From 938e89c08ff1e41d18a159a5f125a860f7f83bcc Mon Sep 17 00:00:00 2001 From: Valentin Haenel Date: Mon, 4 Jun 2012 16:08:48 +0200 Subject: [PATCH 07/16] use git shortlog and .mailmap to remove duplicates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When using the basic log command one of the authors shows up twice: zsh» git log --all --format='%an <%ae>' | sort -u -k2 Vincent Demeester Richard Hartmann Richard Hartmann Dieter Plaetinck Corey Quinn Gernot Schulz If you instead use the git shortlog version with the .mailmap file you get: zsh» git shortlog -se --all | cut -f1 --complement | sort -u -k2 Vincent Demeester Richard Hartmann Dieter Plaetinck Corey Quinn Gernot Schulz Alphabetical sorting on the second field (which, incidentally, may be a middle name) is preserved. --- .mailmap | 1 + tools/list_AUTHORS | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..bf08497 --- /dev/null +++ b/.mailmap @@ -0,0 +1 @@ +Richard Hartmann diff --git a/tools/list_AUTHORS b/tools/list_AUTHORS index 2b91ac9..3518205 100755 --- a/tools/list_AUTHORS +++ b/tools/list_AUTHORS @@ -2,4 +2,4 @@ echo 'Alphabetical list of everyone who ever committed to this repository ' -git log --all --format='%an <%ae>' | sort -u -k2 +git shortlog -se --all | cut -f1 --complement | sort -u -k2 -- 2.39.5 From 8c1762a3b598e0cf7a3a55d16069c6829d77db82 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Thu, 28 Jun 2012 15:01:46 +0200 Subject: [PATCH 08/16] Sort AUTHORS alphabetically --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 5e52a9d..e6c3f11 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,7 +1,7 @@ Alphabetical list of everyone who ever committed to this repository Vincent Demeester -Richard Hartmann +Valentin Haenel Richard Hartmann Dieter Plaetinck Corey Quinn -- 2.39.5 From 68ed073de69ed5c5a0ca176ca4d82869b830fc14 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Thu, 28 Jun 2012 15:08:59 +0200 Subject: [PATCH 09/16] Add PACKAGING * Point out that Debian packaging lives in branches in this repo * Ask third parties to contribute their work so it can be included --- PACKAGING | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 PACKAGING diff --git a/PACKAGING b/PACKAGING new file mode 100644 index 0000000..16eaed8 --- /dev/null +++ b/PACKAGING @@ -0,0 +1,18 @@ +# Archlinux + +AUR does not require any packaging information within this repository. + +# Debian + +Debian packages are provided by the author in separate branches, maintained in +the upstream repository + +## Ubuntu + +Ubuntu imports Debian's package automagically. + +# Anything else + +If you are maintaining a package for a different distribution, please get +in touch so your work can be included in another branch, thus allowing others +to adapt it to their needs or to improve it. -- 2.39.5 From 47558cb545fbf6e175c75fe04741ffd78754f222 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Thu, 28 Jun 2012 15:10:01 +0200 Subject: [PATCH 10/16] Clarify stance on GPLv2+ vs GPLv3+ --- vcsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vcsh b/vcsh index c6ea395..ce8d385 100755 --- a/vcsh +++ b/vcsh @@ -5,6 +5,11 @@ # For details, see LICENSE. To submit patches, you have to agree to # license your code under the GNU GPL version 2 or later. +# While the following is not legally binding, the author would like to +# explain the choice of GPLv2+ over GPLv3+. +# The author prefers GPLv3+ over GPLv2+ but feels it's better to maintain +# full compability with git. In case git ever changes its licensing terms, +# this software will most likely follow suit. [ -n "$VCSH_DEBUG" ] && set -vx [ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config" -- 2.39.5 From af34387542dd1524498adba5d8850fbfa15aa02f Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Thu, 28 Jun 2012 15:13:26 +0200 Subject: [PATCH 11/16] Point out incompability to `git submodule` This should help users of Debian Wheezy find their way to a potential future backport. --- doc/vcsh.1.ronn | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn index 76ae2a5..0fbead9 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn @@ -160,6 +160,12 @@ You can put any and all commands into this config file and they will be executed None are known at this time, but reports and/or patches are more than welcome. +## KNOWN ISSUES + +As of this writing (June 2012), `vcsh` does not work with `git submodule` due +to limitations within `git`. Depending on when you are reading this, you might +want to consider upgrading. + ## HISTORY Like most people, the author initially made do with a single repository for all -- 2.39.5 From eaafe75591b135cd256e4c77e21be199131407d5 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Fri, 29 Jun 2012 11:37:07 +0200 Subject: [PATCH 12/16] Make `vcsh list` even more resilient ;) --- vcsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcsh b/vcsh index ce8d385..358135a 100755 --- a/vcsh +++ b/vcsh @@ -139,7 +139,7 @@ init() { list() { for repo in "$VCSH_REPO_D"/*.git; do - [ -r "$repo" ] && echo $(basename "$repo" .git) + [ -d "$repo" ] && [ -r "$repo" ] && echo $(basename "$repo" .git) done } -- 2.39.5 From 326493cc7976584bcbe13ab8e01a697a4368f7f9 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Fri, 29 Jun 2012 22:46:16 +0200 Subject: [PATCH 13/16] Release 1.0 --- changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog b/changelog index bfc4d24..52c7ed2 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,10 @@ +2012-06-30 Richard Hartmann + + * Release 1.0 + * Make `vcsh list` more resilient + * Lots of doc improvements + + 2012-02-27 Richard Hartmann * Refactor Makefile -- 2.39.5 From 2dcbc4d6ccedf064aaec330b585652900cc2c061 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Thu, 30 Aug 2012 00:39:03 +0200 Subject: [PATCH 14/16] Add command line options * -c: Source prior to other configuration files * -d: Enable debug mode * -v: Enable verbose mode --- doc/vcsh.1.ronn | 17 +++++++++++++++-- vcsh | 44 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn index 0fbead9..88ebd9d 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn @@ -3,6 +3,8 @@ vcsh(1) - manage config files in $HOME via fake bare git repositories ## SYNOPSIS +`vcsh` [] + `vcsh` clone [] `vcsh` delete @@ -21,7 +23,7 @@ vcsh(1) - manage config files in $HOME via fake bare git repositories `vcsh` rename -`vcsh` run +`vcsh` run `vcsh` setup @@ -29,7 +31,7 @@ vcsh(1) - manage config files in $HOME via fake bare git repositories `vcsh` write-gitignore -`vcsh` +`vcsh` `vcsh` @@ -59,6 +61,17 @@ an interactive user. ## OPTIONS +* -c: + Source prior to other configuration files + +* -d: + Enable debug mode + +* -v: + Enable verbose mode + +## COMMANDS + * clone: Clone an existing repository. diff --git a/vcsh b/vcsh index 358135a..9a4f4aa 100755 --- a/vcsh +++ b/vcsh @@ -11,6 +11,35 @@ # full compability with git. In case git ever changes its licensing terms, # this software will most likely follow suit. +SELF=$(basename $0) + +fatal() { + echo "$SELF: fatal: $1" >&2 + exit $2 +} + +# We need to run getops as soon as possible so we catch -d and other +# options that will modify our behaviour. +# Commands are handled at the end of this script. +while getopts "c:dv" flag; do + if [ "$1" = '-d' ] || [ "$1" = '--debug' ]; then + set -vx + VCSH_DEBUG=1 + shift 1 + elif [ "$1" = '-v' ];then + VCSH_VERBOSE=1 + elif [ "$1" = '-c' ];then + # Source $OPTARG if it can be read and has an absolute or relative + # path or is in $PATH + if [ -r "$OPTARG" ]; then + . "$OPTARG" + else + fatal "Can not read configuration file '$OPTARG'" 1 + fi + fi +done + + [ -n "$VCSH_DEBUG" ] && set -vx [ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config" [ -r "$XDG_CONFIG_HOME/vcsh/config" ] && . "$XDG_CONFIG_HOME/vcsh/config" @@ -20,11 +49,15 @@ [ -z "$VCSH_BASE" ] && VCSH_BASE="$HOME" [ -z "$VCSH_GITIGNORE" ] && VCSH_GITIGNORE='exact' -SELF=$(basename $0) - help() { - echo "usage: $SELF + echo "usage: $SELF + + options: + -c Source file prior to other configuration files + -d Enable debug mode + -d Enable verbose mode + commands: clone \\ [] Clone from an existing repository delete Delete an existing repository @@ -56,11 +89,6 @@ verbose() { if [ -n "$VCSH_DEBUG" ] || [ -n "$VCSH_VERBOSE" ]; then echo "$SELF: verbose: $@"; fi } -fatal() { - echo "$SELF: fatal: $1" >&2 - exit $2 -} - error() { echo "$SELF: error: $1" >&2 } -- 2.39.5 From fd1e40043c417a0c6f352016899bccebbf2b708a Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Tue, 11 Sep 2012 21:25:59 +0200 Subject: [PATCH 15/16] Refer users of `git submodule` to v1.7.12 or later See commits * be8779f7ac9a3be9aa783df008d59082f4054f67 * 95e7705310bce3b2721ebf789776c170cf424abb in git's git repository --- doc/vcsh.1.ronn | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn index 88ebd9d..bab8bcd 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn @@ -173,11 +173,10 @@ You can put any and all commands into this config file and they will be executed None are known at this time, but reports and/or patches are more than welcome. -## KNOWN ISSUES +## INTEROPERABILITY -As of this writing (June 2012), `vcsh` does not work with `git submodule` due -to limitations within `git`. Depending on when you are reading this, you might -want to consider upgrading. +If you rely on `git submodule`, use `git` 1.7.12 or later. Earlier versions +do not clean internal variables properly before descending into a submodule. ## HISTORY -- 2.39.5 From 807ddaaed8d86a117871c41895346f25f6f93890 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Tue, 11 Sep 2012 21:27:29 +0200 Subject: [PATCH 16/16] Support more configuration files Supported files * /etc/vcsh/config * $XDG_CONFIG_HOME/vcsh/config * vcsh -c --- doc/vcsh.1.ronn | 60 ++++++++++++++++++++++++++++++++++++++++++++++--- vcsh | 33 ++++++++++++++++++++------- 2 files changed, 82 insertions(+), 11 deletions(-) diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn index bab8bcd..efb5ba5 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn @@ -130,6 +130,59 @@ an interactive user. As noted earlier, `vcsh` will set <$GIT_DIR> and <$GIT_WORK_TREE> to the appropriate values for fake bare git repositories. +## CONFIG + +There are several ways to turn the various knobs on `vcsh`. In order of +ascending precedence, they are: + +* `VARIABLE=foo vcsh` +* +* <$XDG_CONFIG_HOME/vcsh/config> +* `vcsh -c ` + +Please note that those files are sourced. Any and all commands will be +executed in the context of your shell. + +Interesting knobs you can turn: + +* <$VCSH_GITIGNORE>: + Can be either or . + + will seed the repo-specific <.gitignore> with all file and directory + names which `git ls-files` returns. + + will descend through all directories recursively additionally to + the above. + + Defaults to . + +Less interesting knobs you could turn: + +* <$VCSH_DEBUG>: + Enter debug mode. + +* <$XDG_CONFIG_HOME>: + As specified in the 'XDG Base Directory Specification', see + + + Defaults to <$HOME/.config>. + +* <$VCSH_REPO_D>: + The directory where repositories are read from and stored. + + Defaults to <$XDG_CONFIG_HOME/vcsh/repo.d>. + +* <$VCSH_HOOK_D>: + The directory where hooks are read from. + + Defaults to <$XDG_CONFIG_HOME/vcsh/hooks-enabled>. + +* <$VCSH_BASE>: + The directory where repositories are checked out to. + + Defaults to <$HOME>. + + ## HOOK SYSTEM `vcsh` provides a hook system. Hook scripts must be executable and should be @@ -163,11 +216,12 @@ On Debian-based systems, this file can be found in . ## SECURITY CONSIDERATIONS -`vcsh` allows you to execute arbitrary commands via `vcsh` run. For example, +`vcsh` allows you to execute arbitrary commands via `vcsh run`. For example, adding a `sudo`(8) rule for `vcsh` would be pretty stupid. -Additionally, vcsh will source, i.e. execute, <$XDG_CONFIG_HOME/vcsh/config>. -You can put any and all commands into this config file and they will be executed. +Additionally, vcsh will source, i.e. execute, all files listed in . +You can put any and all commands into these config files and they will be +executed. ## BUGS diff --git a/vcsh b/vcsh index 9a4f4aa..594368d 100755 --- a/vcsh +++ b/vcsh @@ -29,31 +29,48 @@ while getopts "c:dv" flag; do elif [ "$1" = '-v' ];then VCSH_VERBOSE=1 elif [ "$1" = '-c' ];then - # Source $OPTARG if it can be read and has an absolute or relative - # path or is in $PATH - if [ -r "$OPTARG" ]; then - . "$OPTARG" - else - fatal "Can not read configuration file '$OPTARG'" 1 - fi + VCSH_OPTION_CONFIG=$OPTARG fi done +source_all() { + # Source file even if it's in $PWD and does not have any slashes in it + case "$1" in + */*) . "$1";; + *) . "$PWD/$1";; + esac; +} + +# Read configuration and set defaults if anything's not set [ -n "$VCSH_DEBUG" ] && set -vx [ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config" + +# Read configuration files if there are any +[ -r "/etc/vcsh/config" ] && . "/etc/vcsh/config" [ -r "$XDG_CONFIG_HOME/vcsh/config" ] && . "$XDG_CONFIG_HOME/vcsh/config" +if [ -n "$VCSH_OPTION_CONFIG" ]; then + # Source $VCSH_OPTION_CONFIG if it can be read and is in $PWD of $PATH + if [ -r "$VCSH_OPTION_CONFIG" ]; then + source_all "$VCSH_OPTION_CONFIG" + else + fatal "Can not read configuration file '$VCSH_OPTION_CONFIG'" 1 + fi +fi [ -n "$VCSH_DEBUG" ] && set -vx + +# Read defaults [ -z "$VCSH_REPO_D" ] && VCSH_REPO_D="$XDG_CONFIG_HOME/vcsh/repo.d" [ -z "$VCSH_HOOK_D" ] && VCSH_HOOK_D="$XDG_CONFIG_HOME/vcsh/hooks-enabled" [ -z "$VCSH_BASE" ] && VCSH_BASE="$HOME" [ -z "$VCSH_GITIGNORE" ] && VCSH_GITIGNORE='exact' + help() { echo "usage: $SELF options: - -c Source file prior to other configuration files + -c Source file -d Enable debug mode -d Enable verbose mode -- 2.39.5