From 9a1fcf98e9f1c30a6e072c96420f24d9539889ef Mon Sep 17 00:00:00 2001 From: Aggelos Orfanakos Date: Thu, 2 Sep 2010 08:31:57 +0300 Subject: [PATCH 1/3] Add git-setup --- Readme.md | 7 ++++++- bin/git-setup | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 bin/git-setup diff --git a/Readme.md b/Readme.md index 05a2a3a..8371924 100644 --- a/Readme.md +++ b/Readme.md @@ -23,6 +23,7 @@ - git repl - git undo - git update-extras + - git setup ## git-contrib @@ -228,4 +229,8 @@ Remove the latest 3 commits: ## git-update-extras - Updates git extras. clones the repo to _/tmp/git-extras_, make installs, then cds back to the origin directory. \ No newline at end of file + Updates git extras. clones the repo to _/tmp/git-extras_, make installs, then cds back to the origin directory. + +## git-setup + +Set up a git repository if one doesn't exist, add all files and make an initial commit. diff --git a/bin/git-setup b/bin/git-setup new file mode 100755 index 0000000..0d33d14 --- /dev/null +++ b/bin/git-setup @@ -0,0 +1,6 @@ +#!/bin/sh + +test -z "$1" && echo "path required." && exit 1 +cd "$1" +[[ -d .git ]] && exit +git init && git add . && git commit -m 'Initial commit' From cefe4689f250d1c6dc49bc34440469d73fcaf2c8 Mon Sep 17 00:00:00 2001 From: Aggelos Orfanakos Date: Thu, 2 Sep 2010 10:28:10 +0300 Subject: [PATCH 2/3] Use wildcard function for $(BINS) --- Makefile | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 1012686..649188f 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,19 @@ PREFIX = /usr/local -BINS = \ - git-count \ - git-ignore \ - git-changelog \ - git-delete-branch \ - git-delete-tag \ - git-fresh-branch \ - git-graft \ - git-repl \ - git-commits-since \ - git-summary \ - git-contrib \ - git-update-extras \ - git-extras-version \ - git-release \ - git-undo +BINS = $(wildcard bin/git-*) install: @echo "... installing to $(PREFIX)/bin" @$(foreach BIN, $(BINS), \ - echo "... installing $(BIN)"; \ - cp -f bin/$(BIN) $(PREFIX)/bin/$(BIN); \ + echo "... installing `basename $(BIN)`"; \ + cp -f $(BIN) $(PREFIX)/$(BIN); \ ) uninstall: @$(foreach BIN, $(BINS), \ - echo "... uninstalling $(PREFIX)/bin/$(BIN)"; \ - rm -f $(PREFIX)/bin/$(BIN); \ + echo "... uninstalling $(PREFIX)/$(BIN)"; \ + rm -f $(PREFIX)/$(BIN); \ ) -.PHONY: install uninstall \ No newline at end of file +.PHONY: install uninstall From 488a15de7a7a5b2c7efb016fe79f1101999f2dc3 Mon Sep 17 00:00:00 2001 From: Aggelos Orfanakos Date: Thu, 2 Sep 2010 20:06:08 +0300 Subject: [PATCH 3/3] Use `test -d` for a more compatible directory check --- bin/git-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-setup b/bin/git-setup index 0d33d14..0320523 100755 --- a/bin/git-setup +++ b/bin/git-setup @@ -2,5 +2,5 @@ test -z "$1" && echo "path required." && exit 1 cd "$1" -[[ -d .git ]] && exit +test -d .git && exit git init && git add . && git commit -m 'Initial commit'