summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash10
-rwxr-xr-xcontrib/convert-grafts-to-replace-refs.sh28
-rw-r--r--contrib/credential/wincred/Makefile16
-rw-r--r--contrib/diffall/README31
-rwxr-xr-xcontrib/diffall/git-diffall257
-rw-r--r--contrib/examples/builtin-fetch--tool.c3
-rwxr-xr-xcontrib/examples/git-clone.sh2
-rwxr-xr-xcontrib/examples/git-commit.sh4
-rwxr-xr-xcontrib/examples/git-merge.sh4
-rwxr-xr-xcontrib/examples/git-repack.sh4
-rwxr-xr-xcontrib/examples/git-resolve.sh2
-rwxr-xr-xcontrib/mw-to-git/git-remote-mediawiki.perl7
-rwxr-xr-xcontrib/mw-to-git/t/install-wiki.sh10
-rwxr-xr-xcontrib/mw-to-git/t/t9363-mw-to-git-export-import.sh19
-rwxr-xr-xcontrib/mw-to-git/t/t9365-continuing-queries.sh2
-rwxr-xr-xcontrib/mw-to-git/t/test-gitmw-lib.sh8
-rw-r--r--contrib/subtree/Makefile46
-rwxr-xr-xcontrib/subtree/git-subtree.sh3
-rwxr-xr-xcontrib/subtree/t/t7900-subtree.sh5
-rwxr-xr-xcontrib/svn-fe/svnrdump_sim.py93
-rwxr-xr-xcontrib/thunderbird-patch-inline/appp.sh14
-rw-r--r--contrib/vim/README22
22 files changed, 194 insertions, 396 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5ba24ee..06bf262 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -21,6 +21,12 @@
# source ~/.git-completion.sh
# 3) Consider changing your PS1 to also show the current branch,
# see git-prompt.sh for details.
+#
+# If you use complex aliases of form '!f() { ... }; f', you can use the null
+# command ':' as the first command in the function body to declare the desired
+# completion style. For example '!f() { : git commit ; ... }; f' will
+# tell the completion to use commit completion. This also works with aliases
+# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '".
case "$COMP_WORDBREAKS" in
*:*) : great ;;
@@ -781,6 +787,10 @@ __git_aliased_command ()
-*) : option ;;
*=*) : setting env ;;
git) : git itself ;;
+ \(\)) : skip parens of shell function definition ;;
+ {) : skip start of shell helper function ;;
+ :) : skip null command ;;
+ \'*) : skip opening quote after sh -c ;;
*)
echo "$word"
return
diff --git a/contrib/convert-grafts-to-replace-refs.sh b/contrib/convert-grafts-to-replace-refs.sh
new file mode 100755
index 0000000..0cbc917
--- /dev/null
+++ b/contrib/convert-grafts-to-replace-refs.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# You should execute this script in the repository where you
+# want to convert grafts to replace refs.
+
+GRAFTS_FILE="${GIT_DIR:-.git}/info/grafts"
+
+. $(git --exec-path)/git-sh-setup
+
+test -f "$GRAFTS_FILE" || die "Could not find graft file: '$GRAFTS_FILE'"
+
+grep '^[^# ]' "$GRAFTS_FILE" |
+while read definition
+do
+ if test -n "$definition"
+ then
+ echo "Converting: $definition"
+ git replace --graft $definition ||
+ die "Conversion failed for: $definition"
+ fi
+done
+
+mv "$GRAFTS_FILE" "$GRAFTS_FILE.bak" ||
+ die "Could not rename '$GRAFTS_FILE' to '$GRAFTS_FILE.bak'"
+
+echo "Success!"
+echo "All the grafts in '$GRAFTS_FILE' have been converted to replace refs!"
+echo "The grafts file '$GRAFTS_FILE' has been renamed: '$GRAFTS_FILE.bak'"
diff --git a/contrib/credential/wincred/Makefile b/contrib/credential/wincred/Makefile
index bad45ca..6e992c0 100644
--- a/contrib/credential/wincred/Makefile
+++ b/contrib/credential/wincred/Makefile
@@ -1,14 +1,22 @@
all: git-credential-wincred.exe
-CC = gcc
-RM = rm -f
-CFLAGS = -O2 -Wall
-
-include ../../../config.mak.autogen
-include ../../../config.mak
+CC ?= gcc
+RM ?= rm -f
+CFLAGS ?= -O2 -Wall
+
+prefix ?= /usr/local
+libexecdir ?= $(prefix)/libexec/git-core
+
+INSTALL ?= install
+
git-credential-wincred.exe : git-credential-wincred.c
$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
+install: git-credential-wincred.exe
+ $(INSTALL) -m 755 $^ $(libexecdir)
+
clean:
$(RM) git-credential-wincred.exe
diff --git a/contrib/diffall/README b/contrib/diffall/README
deleted file mode 100644
index 507f17d..0000000
--- a/contrib/diffall/README
+++ /dev/null
@@ -1,31 +0,0 @@
-The git-diffall script provides a directory based diff mechanism
-for git.
-
-To determine what diff viewer is used, the script requires either
-the 'diff.tool' or 'merge.tool' configuration option to be set.
-
-This script is compatible with most common forms used to specify a
-range of revisions to diff:
-
- 1. git diffall: shows diff between working tree and staged changes
- 2. git diffall --cached [<commit>]: shows diff between staged
- changes and HEAD (or other named commit)
- 3. git diffall <commit>: shows diff between working tree and named
- commit
- 4. git diffall <commit> <commit>: show diff between two named commits
- 5. git diffall <commit>..<commit>: same as above
- 6. git diffall <commit>...<commit>: show the changes on the branch
- containing and up to the second, starting at a common ancestor
- of both <commit>
-
-Note: all forms take an optional path limiter [-- <path>*]
-
-The '--extcmd=<command>' option allows the user to specify a custom
-command for viewing diffs. When given, configured defaults are
-ignored and the script runs $command $LOCAL $REMOTE. Additionally,
-$BASE is set in the environment.
-
-This script is based on an example provided by Thomas Rast on the
-Git list [1]:
-
-[1] http://thread.gmane.org/gmane.comp.version-control.git/124807
diff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall
deleted file mode 100755
index 84f2b65..0000000
--- a/contrib/diffall/git-diffall
+++ /dev/null
@@ -1,257 +0,0 @@
-#!/bin/sh
-# Copyright 2010 - 2012, Tim Henigan <tim.henigan@gmail.com>
-#
-# Perform a directory diff between commits in the repository using
-# the external diff or merge tool specified in the user's config.
-
-USAGE='[--cached] [--copy-back] [-x|--extcmd=<command>] <commit>{0,2} [-- <path>*]
-
- --cached Compare to the index rather than the working tree.
-
- --copy-back Copy files back to the working tree when the diff
- tool exits (in case they were modified by the
- user). This option is only valid if the diff
- compared with the working tree.
-
- -x=<command>
- --extcmd=<command> Specify a custom command for viewing diffs.
- git-diffall ignores the configured defaults and
- runs $command $LOCAL $REMOTE when this option is
- specified. Additionally, $BASE is set in the
- environment.
-'
-
-SUBDIRECTORY_OK=1
-. "$(git --exec-path)/git-sh-setup"
-
-TOOL_MODE=diff
-. "$(git --exec-path)/git-mergetool--lib"
-
-merge_tool="$(get_merge_tool)"
-if test -z "$merge_tool"
-then
- echo "Error: Either the 'diff.tool' or 'merge.tool' option must be set."
- usage
-fi
-
-start_dir=$(pwd)
-
-# All the file paths returned by the diff command are relative to the root
-# of the working copy. So if the script is called from a subdirectory, it
-# must switch to the root of working copy before trying to use those paths.
-cdup=$(git rev-parse --show-cdup) &&
-cd "$cdup" || {
- echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
- exit 1
-}
-
-# set up temp dir
-tmp=$(perl -e 'use File::Temp qw(tempdir);
- $t=tempdir("/tmp/git-diffall.XXXXX") or exit(1);
- print $t') || exit 1
-trap 'rm -rf "$tmp"' EXIT
-
-left=
-right=
-paths=
-dashdash_seen=
-compare_staged=
-merge_base=
-left_dir=
-right_dir=
-diff_tool=
-copy_back=
-
-while test $# != 0
-do
- case "$1" in
- -h|--h|--he|--hel|--help)
- usage
- ;;
- --cached)
- compare_staged=1
- ;;
- --copy-back)
- copy_back=1
- ;;
- -x|--e|--ex|--ext|--extc|--extcm|--extcmd)
- if test $# = 1
- then
- echo You must specify the tool for use with --extcmd
- usage
- else
- diff_tool=$2
- shift
- fi
- ;;
- --)
- dashdash_seen=1
- ;;
- -*)
- echo Invalid option: "$1"
- usage
- ;;
- *)
- # could be commit, commit range or path limiter
- case "$1" in
- *...*)
- left=${1%...*}
- right=${1#*...}
- merge_base=1
- ;;
- *..*)
- left=${1%..*}
- right=${1#*..}
- ;;
- *)
- if test -n "$dashdash_seen"
- then
- paths="$paths$1 "
- elif test -z "$left"
- then
- left=$1
- elif test -z "$right"
- then
- right=$1
- else
- paths="$paths$1 "
- fi
- ;;
- esac
- ;;
- esac
- shift
-done
-
-# Determine the set of files which changed
-if test -n "$left" && test -n "$right"
-then
- left_dir="cmt-$(git rev-parse --short $left)"
- right_dir="cmt-$(git rev-parse --short $right)"
-
- if test -n "$compare_staged"
- then
- usage
- elif test -n "$merge_base"
- then
- git diff --name-only "$left"..."$right" -- $paths >"$tmp/filelist"
- else
- git diff --name-only "$left" "$right" -- $paths >"$tmp/filelist"
- fi
-elif test -n "$left"
-then
- left_dir="cmt-$(git rev-parse --short $left)"
-
- if test -n "$compare_staged"
- then
- right_dir="staged"
- git diff --name-only --cached "$left" -- $paths >"$tmp/filelist"
- else
- right_dir="working_tree"
- git diff --name-only "$left" -- $paths >"$tmp/filelist"
- fi
-else
- left_dir="HEAD"
-
- if test -n "$compare_staged"
- then
- right_dir="staged"
- git diff --name-only --cached -- $paths >"$tmp/filelist"
- else
- right_dir="working_tree"
- git diff --name-only -- $paths >"$tmp/filelist"
- fi
-fi
-
-# Exit immediately if there are no diffs
-if test ! -s "$tmp/filelist"
-then
- exit 0
-fi
-
-if test -n "$copy_back" && test "$right_dir" != "working_tree"
-then
- echo "--copy-back is only valid when diff includes the working tree."
- exit 1
-fi
-
-# Create the named tmp directories that will hold the files to be compared
-mkdir -p "$tmp/$left_dir" "$tmp/$right_dir"
-
-# Populate the tmp/right_dir directory with the files to be compared
-while read name
-do
- if test -n "$right"
- then
- ls_list=$(git ls-tree $right "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$right_dir/$(dirname "$name")"
- git show "$right":"$name" >"$tmp/$right_dir/$name" || true
- fi
- elif test -n "$compare_staged"
- then
- ls_list=$(git ls-files -- "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$right_dir/$(dirname "$name")"
- git show :"$name" >"$tmp/$right_dir/$name"
- fi
- else
- if test -e "$name"
- then
- mkdir -p "$tmp/$right_dir/$(dirname "$name")"
- cp "$name" "$tmp/$right_dir/$name"
- fi
- fi
-done < "$tmp/filelist"
-
-# Populate the tmp/left_dir directory with the files to be compared
-while read name
-do
- if test -n "$left"
- then
- ls_list=$(git ls-tree $left "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$left_dir/$(dirname "$name")"
- git show "$left":"$name" >"$tmp/$left_dir/$name" || true
- fi
- else
- if test -n "$compare_staged"
- then
- ls_list=$(git ls-tree HEAD "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$left_dir/$(dirname "$name")"
- git show HEAD:"$name" >"$tmp/$left_dir/$name"
- fi
- else
- mkdir -p "$tmp/$left_dir/$(dirname "$name")"
- git show :"$name" >"$tmp/$left_dir/$name"
- fi
- fi
-done < "$tmp/filelist"
-
-LOCAL="$tmp/$left_dir"
-REMOTE="$tmp/$right_dir"
-
-if test -n "$diff_tool"
-then
- export BASE
- eval $diff_tool '"$LOCAL"' '"$REMOTE"'
-else
- run_merge_tool "$merge_tool" false
-fi
-
-# Copy files back to the working dir, if requested
-if test -n "$copy_back" && test "$right_dir" = "working_tree"
-then
- cd "$start_dir"
- git_top_dir=$(git rev-parse --show-toplevel)
- find "$tmp/$right_dir" -type f |
- while read file
- do
- cp "$file" "$git_top_dir/${file#$tmp/$right_dir/}"
- done
-fi
diff --git a/contrib/examples/builtin-fetch--tool.c b/contrib/examples/builtin-fetch--tool.c
index 8bc8c75..ee19166 100644
--- a/contrib/examples/builtin-fetch--tool.c
+++ b/contrib/examples/builtin-fetch--tool.c
@@ -31,7 +31,8 @@ static int update_ref_env(const char *action,
rla = "(reflog update)";
if (snprintf(msg, sizeof(msg), "%s: %s", rla, action) >= sizeof(msg))
warning("reflog message too long: %.*s...", 50, msg);
- return update_ref(msg, refname, sha1, oldval, 0, QUIET_ON_ERR);
+ return update_ref(msg, refname, sha1, oldval, 0,
+ UPDATE_REFS_QUIET_ON_ERR);
}
static int update_local_ref(const char *name,
diff --git a/contrib/examples/git-clone.sh b/contrib/examples/git-clone.sh
index b4c9376..08cf246 100755
--- a/contrib/examples/git-clone.sh
+++ b/contrib/examples/git-clone.sh
@@ -516,7 +516,7 @@ then
case "$no_checkout" in
'')
- test "z$quiet" = z -a "z$no_progress" = z && v=-v || v=
+ test "z$quiet" = z && test "z$no_progress" = z && v=-v || v=
git read-tree -m -u $v HEAD HEAD
esac
fi
diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh
index 5cafe2e..934505b 100755
--- a/contrib/examples/git-commit.sh
+++ b/contrib/examples/git-commit.sh
@@ -51,7 +51,7 @@ run_status () {
export GIT_INDEX_FILE
fi
- if test "$status_only" = "t" -o "$use_status_color" = "t"; then
+ if test "$status_only" = "t" || test "$use_status_color" = "t"; then
color=
else
color=--nocolor
@@ -296,7 +296,7 @@ t,,,[1-9]*)
die "No paths with -i does not make sense." ;;
esac
-if test ! -z "$templatefile" -a -z "$log_given"
+if test ! -z "$templatefile" && test -z "$log_given"
then
if test ! -f "$templatefile"
then
diff --git a/contrib/examples/git-merge.sh b/contrib/examples/git-merge.sh
index 7e40f40..52f2aaf 100755
--- a/contrib/examples/git-merge.sh
+++ b/contrib/examples/git-merge.sh
@@ -161,7 +161,7 @@ merge_name () {
return
fi
fi
- if test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD"
+ if test "$remote" = "FETCH_HEAD" && test -r "$GIT_DIR/FETCH_HEAD"
then
sed -e 's/ not-for-merge / /' -e 1q \
"$GIT_DIR/FETCH_HEAD"
@@ -527,7 +527,7 @@ do
git diff-files --name-only
git ls-files --unmerged
} | wc -l`
- if test $best_cnt -le 0 -o $cnt -le $best_cnt
+ if test $best_cnt -le 0 || test $cnt -le $best_cnt
then
best_strategy=$strategy
best_cnt=$cnt
diff --git a/contrib/examples/git-repack.sh b/contrib/examples/git-repack.sh
index f312405..96e3fed 100755
--- a/contrib/examples/git-repack.sh
+++ b/contrib/examples/git-repack.sh
@@ -76,8 +76,8 @@ case ",$all_into_one," in
existing="$existing $e"
fi
done
- if test -n "$existing" -a -n "$unpack_unreachable" -a \
- -n "$remove_redundant"
+ if test -n "$existing" && test -n "$unpack_unreachable" && \
+ test -n "$remove_redundant"
then
# This may have arbitrary user arguments, so we
# have to protect it against whitespace splitting
diff --git a/contrib/examples/git-resolve.sh b/contrib/examples/git-resolve.sh
index 48d0fc9..70fdc27 100755
--- a/contrib/examples/git-resolve.sh
+++ b/contrib/examples/git-resolve.sh
@@ -76,7 +76,7 @@ case "$common" in
2>/dev/null || continue
# Count the paths that are unmerged.
cnt=$(GIT_INDEX_FILE=$G git ls-files --unmerged | wc -l)
- if test $best_cnt -le 0 -o $cnt -le $best_cnt
+ if test $best_cnt -le 0 || test $cnt -le $best_cnt
then
best=$c
best_cnt=$cnt
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 3f8d993..8dd74a9 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -461,7 +461,12 @@ sub download_mw_mediafile {
my $response = $mediawiki->{ua}->get($download_url);
if ($response->code == HTTP_CODE_OK) {
- return $response->decoded_content;
+ # It is tempting to return
+ # $response->decoded_content({charset => "none"}), but
+ # when doing so, utf8::downgrade($content) fails with
+ # "Wide character in subroutine entry".
+ $response->decode();
+ return $response->content();
} else {
print {*STDERR} "Error downloading mediafile from :\n";
print {*STDERR} "URL: ${download_url}\n";
diff --git a/contrib/mw-to-git/t/install-wiki.sh b/contrib/mw-to-git/t/install-wiki.sh
index 70a53f6..c215213 100755
--- a/contrib/mw-to-git/t/install-wiki.sh
+++ b/contrib/mw-to-git/t/install-wiki.sh
@@ -20,6 +20,8 @@ usage () {
echo " install | -i : Install a wiki on your computer."
echo " delete | -d : Delete the wiki and all its pages and "
echo " content."
+ echo " start | -s : Start the previously configured lighttpd daemon"
+ echo " stop : Stop lighttpd daemon."
}
@@ -33,6 +35,14 @@ case "$1" in
wiki_delete
exit 0
;;
+ "start" | "-s")
+ start_lighttpd
+ exit
+ ;;
+ "stop")
+ stop_lighttpd
+ exit
+ ;;
"--help" | "-h")
usage
exit 0
diff --git a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
index 5a03739..3ff3a09 100755
--- a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
+++ b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
@@ -58,6 +58,25 @@ test_expect_success 'git clone works on previously created wiki with media files
test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt
'
+test_expect_success 'git push can upload media (File:) files containing valid UTF-8' '
+ wiki_reset &&
+ git clone mediawiki::'"$WIKI_URL"' mw_dir &&
+ (
+ cd mw_dir &&
+ "$PERL_PATH" -e "print STDOUT \"UTF-8 content: éèàéê€.\";" >Bar.txt &&
+ git add Bar.txt &&
+ git commit -m "add a text file with UTF-8 content" &&
+ git push
+ )
+'
+
+test_expect_success 'git clone works on previously created wiki with media files containing valid UTF-8' '
+ test_when_finished "rm -rf mw_dir mw_dir_clone" &&
+ git clone -c remote.origin.mediaimport=true \
+ mediawiki::'"$WIKI_URL"' mw_dir_clone &&
+ test_cmp mw_dir_clone/Bar.txt mw_dir/Bar.txt
+'
+
test_expect_success 'git push & pull work with locally renamed media files' '
wiki_reset &&
git clone mediawiki::'"$WIKI_URL"' mw_dir &&
diff --git a/contrib/mw-to-git/t/t9365-continuing-queries.sh b/contrib/mw-to-git/t/t9365-continuing-queries.sh
index 27e267f..0164547 100755
--- a/contrib/mw-to-git/t/t9365-continuing-queries.sh
+++ b/contrib/mw-to-git/t/t9365-continuing-queries.sh
@@ -9,7 +9,7 @@ test_check_precond
test_expect_success 'creating page w/ >500 revisions' '
wiki_reset &&
- for i in `test_seq 501`
+ for i in $(test_seq 501)
do
echo "creating revision $i" &&
wiki_editpage foo "revision $i<br/>" true
diff --git a/contrib/mw-to-git/t/test-gitmw-lib.sh b/contrib/mw-to-git/t/test-gitmw-lib.sh
index 3372b2a..6546294 100755
--- a/contrib/mw-to-git/t/test-gitmw-lib.sh
+++ b/contrib/mw-to-git/t/test-gitmw-lib.sh
@@ -90,7 +90,7 @@ test_diff_directories () {
#
# Check that <dir> contains exactly <N> files
test_contains_N_files () {
- if test `ls -- "$1" | wc -l` -ne "$2"; then
+ if test $(ls -- "$1" | wc -l) -ne "$2"; then
echo "directory $1 should contain $2 files"
echo "it contains these files:"
ls "$1"
@@ -289,7 +289,6 @@ start_lighttpd () {
# Kill daemon lighttpd and removes files and folders associated.
stop_lighttpd () {
test -f "$WEB_TMP/pid" && kill $(cat "$WEB_TMP/pid")
- rm -rf "$WEB"
}
# Create the SQLite database of the MediaWiki. If the database file already
@@ -341,10 +340,10 @@ wiki_install () {
"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
"$MW_FILENAME. "\
"Please fix your connection and launch the script again."
- echo "$MW_FILENAME downloaded in `pwd`. "\
+ echo "$MW_FILENAME downloaded in $(pwd). "\
"You can delete it later if you want."
else
- echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
+ echo "Reusing existing $MW_FILENAME downloaded in $(pwd)."
fi
archive_abs_path=$(pwd)/$MW_FILENAME
cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
@@ -415,6 +414,7 @@ wiki_reset () {
wiki_delete () {
if test $LIGHTTPD = "true"; then
stop_lighttpd
+ rm -fr "$WEB"
else
# Delete the wiki's directory.
rm -rf "$WIKI_DIR_INST/$WIKI_DIR_NAME" ||
diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile
index 4030a16..d9a0ce2 100644
--- a/contrib/subtree/Makefile
+++ b/contrib/subtree/Makefile
@@ -3,17 +3,28 @@
prefix ?= /usr/local
mandir ?= $(prefix)/share/man
-libexecdir ?= $(prefix)/libexec/git-core
-gitdir ?= $(shell git --exec-path)
+gitexecdir ?= $(prefix)/libexec/git-core
man1dir ?= $(mandir)/man1
-gitver ?= $(word 3,$(shell git --version))
+../../GIT-VERSION-FILE: FORCE
+ $(MAKE) -C ../../ GIT-VERSION-FILE
+
+-include ../../GIT-VERSION-FILE
# this should be set to a 'standard' bsd-type install program
-INSTALL ?= install
+INSTALL ?= install
+RM ?= rm -f
+
+ASCIIDOC = asciidoc
+XMLTO = xmlto
-ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
-MANPAGE_NORMAL_XSL = ../../Documentation/manpage-normal.xsl
+ifndef SHELL_PATH
+ SHELL_PATH = /bin/sh
+endif
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
+MANPAGE_XSL = ../../Documentation/manpage-normal.xsl
GIT_SUBTREE_SH := git-subtree.sh
GIT_SUBTREE := git-subtree
@@ -26,13 +37,14 @@ GIT_SUBTREE_HTML := git-subtree.html
all: $(GIT_SUBTREE)
$(GIT_SUBTREE): $(GIT_SUBTREE_SH)
- cp $< $@ && chmod +x $@
+ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
+ chmod +x $@
doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
install: $(GIT_SUBTREE)
- $(INSTALL) -d -m 755 $(DESTDIR)$(libexecdir)
- $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(libexecdir)
+ $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
+ $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
install-doc: install-man
@@ -41,19 +53,21 @@ install-man: $(GIT_SUBTREE_DOC)
$(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
- xmlto -m $(MANPAGE_NORMAL_XSL) man $^
+ $(XMLTO) -m $(MANPAGE_XSL) man $^
$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
- asciidoc -b docbook -d manpage -f $(ASCIIDOC_CONF) \
- -agit_version=$(gitver) $^
+ $(ASCIIDOC) -b docbook -d manpage -f $(ASCIIDOC_CONF) \
+ -agit_version=$(GIT_VERSION) $^
$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
- asciidoc -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \
- -agit_version=$(gitver) $^
+ $(ASCIIDOC) -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \
+ -agit_version=$(GIT_VERSION) $^
test:
$(MAKE) -C t/ test
clean:
- rm -f *~ *.xml *.html *.1
- rm -rf subproj mainline
+ $(RM) $(GIT_SUBTREE)
+ $(RM) *.xml *.html *.1
+
+.PHONY: FORCE
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index db925ca..fa1a583 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -558,8 +558,9 @@ cmd_add_commit()
commit=$(add_squashed_msg "$rev" "$dir" |
git commit-tree $tree $headp -p "$rev") || exit $?
else
+ revp=$(peel_committish "$rev") &&
commit=$(add_msg "$dir" "$headrev" "$rev" |
- git commit-tree $tree $headp -p "$rev") || exit $?
+ git commit-tree $tree $headp -p "$revp") || exit $?
fi
git reset "$commit" || exit $?
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 66ce4b0..6309d12 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -8,7 +8,8 @@ This test verifies the basic operation of the merge, pull, add
and split subcommands of git subtree.
'
-export TEST_DIRECTORY=$(pwd)/../../../t
+TEST_DIRECTORY=$(pwd)/../../../t
+export TEST_DIRECTORY
. ../../../t/test-lib.sh
@@ -76,7 +77,7 @@ test_expect_success 'add sub1' '
# Save this hash for testing later.
-subdir_hash=`git rev-parse HEAD`
+subdir_hash=$(git rev-parse HEAD)
test_expect_success 'add sub2' '
create sub2 &&
diff --git a/contrib/svn-fe/svnrdump_sim.py b/contrib/svn-fe/svnrdump_sim.py
index 4e78a1c..11ac6f6 100755
--- a/contrib/svn-fe/svnrdump_sim.py
+++ b/contrib/svn-fe/svnrdump_sim.py
@@ -5,53 +5,64 @@ of the specified revision range.
To simulate incremental imports the environment variable SVNRMAX can be set
to the highest revision that should be available.
"""
-import sys, os
+import sys
+import os
if sys.hexversion < 0x02040000:
- # The limiter is the ValueError() calls. This may be too conservative
- sys.stderr.write("svnrdump-sim.py: requires Python 2.4 or later.\n")
- sys.exit(1)
+ # The limiter is the ValueError() calls. This may be too conservative
+ sys.stderr.write("svnrdump-sim.py: requires Python 2.4 or later.\n")
+ sys.exit(1)
+
def getrevlimit():
- var = 'SVNRMAX'
- if var in os.environ:
- return os.environ[var]
- return None
+ var = 'SVNRMAX'
+ if var in os.environ:
+ return os.environ[var]
+ return None
+
def writedump(url, lower, upper):
- if url.startswith('sim://'):
- filename = url[6:]
- if filename[-1] == '/': filename = filename[:-1] #remove terminating slash
- else:
- raise ValueError('sim:// url required')
- f = open(filename, 'r');
- state = 'header'
- wroterev = False
- while(True):
- l = f.readline()
- if l == '': break
- if state == 'header' and l.startswith('Revision-number: '):
- state = 'prefix'
- if state == 'prefix' and l == 'Revision-number: %s\n' % lower:
- state = 'selection'
- if not upper == 'HEAD' and state == 'selection' and l == 'Revision-number: %s\n' % upper:
- break;
+ if url.startswith('sim://'):
+ filename = url[6:]
+ if filename[-1] == '/':
+ filename = filename[:-1] # remove terminating slash
+ else:
+ raise ValueError('sim:// url required')
+ f = open(filename, 'r')
+ state = 'header'
+ wroterev = False
+ while(True):
+ l = f.readline()
+ if l == '':
+ break
+ if state == 'header' and l.startswith('Revision-number: '):
+ state = 'prefix'
+ if state == 'prefix' and l == 'Revision-number: %s\n' % lower:
+ state = 'selection'
+ if not upper == 'HEAD' and state == 'selection' and \
+ l == 'Revision-number: %s\n' % upper:
+ break
- if state == 'header' or state == 'selection':
- if state == 'selection': wroterev = True
- sys.stdout.write(l)
- return wroterev
+ if state == 'header' or state == 'selection':
+ if state == 'selection':
+ wroterev = True
+ sys.stdout.write(l)
+ return wroterev
if __name__ == "__main__":
- if not (len(sys.argv) in (3, 4, 5)):
- print("usage: %s dump URL -rLOWER:UPPER")
- sys.exit(1)
- if not sys.argv[1] == 'dump': raise NotImplementedError('only "dump" is suppported.')
- url = sys.argv[2]
- r = ('0', 'HEAD')
- if len(sys.argv) == 4 and sys.argv[3][0:2] == '-r':
- r = sys.argv[3][2:].lstrip().split(':')
- if not getrevlimit() is None: r[1] = getrevlimit()
- if writedump(url, r[0], r[1]): ret = 0
- else: ret = 1
- sys.exit(ret)
+ if not (len(sys.argv) in (3, 4, 5)):
+ print("usage: %s dump URL -rLOWER:UPPER")
+ sys.exit(1)
+ if not sys.argv[1] == 'dump':
+ raise NotImplementedError('only "dump" is suppported.')
+ url = sys.argv[2]
+ r = ('0', 'HEAD')
+ if len(sys.argv) == 4 and sys.argv[3][0:2] == '-r':
+ r = sys.argv[3][2:].lstrip().split(':')
+ if not getrevlimit() is None:
+ r[1] = getrevlimit()
+ if writedump(url, r[0], r[1]):
+ ret = 0
+ else:
+ ret = 1
+ sys.exit(ret)
diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh
index 5eb4a51..8dc73ec 100755
--- a/contrib/thunderbird-patch-inline/appp.sh
+++ b/contrib/thunderbird-patch-inline/appp.sh
@@ -10,7 +10,7 @@ CONFFILE=~/.appprc
SEP="-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-"
if [ -e "$CONFFILE" ] ; then
- LAST_DIR=`grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//'`
+ LAST_DIR=$(grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//')
cd "${LAST_DIR}"
else
cd > /dev/null
@@ -25,11 +25,11 @@ fi
cd - > /dev/null
-SUBJECT=`sed -n -e '/^Subject: /p' "${PATCH}"`
-HEADERS=`sed -e '/^'"${SEP}"'$/,$d' $1`
-BODY=`sed -e "1,/${SEP}/d" $1`
-CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}"`
-DIFF=`sed -e '1,/^---$/d' "${PATCH}"`
+SUBJECT=$(sed -n -e '/^Subject: /p' "${PATCH}")
+HEADERS=$(sed -e '/^'"${SEP}"'$/,$d' $1)
+BODY=$(sed -e "1,/${SEP}/d" $1)
+CMT_MSG=$(sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}")
+DIFF=$(sed -e '1,/^---$/d' "${PATCH}")
CCS=`echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
-e 's/^Signed-off-by: \(.*\)/\1,/gp'`
@@ -48,7 +48,7 @@ if [ "x${BODY}x" != "xx" ] ; then
fi
echo "$DIFF" >> $1
-LAST_DIR=`dirname "${PATCH}"`
+LAST_DIR=$(dirname "${PATCH}")
grep -v "^LAST_DIR=" "${CONFFILE}" > "${CONFFILE}_"
echo "LAST_DIR=${LAST_DIR}" >> "${CONFFILE}_"
diff --git a/contrib/vim/README b/contrib/vim/README
deleted file mode 100644
index 8f16d06..0000000
--- a/contrib/vim/README
+++ /dev/null
@@ -1,22 +0,0 @@
-Syntax highlighting for git commit messages, config files, etc. is
-included with the vim distribution as of vim 7.2, and should work
-automatically.
-
-If you have an older version of vim, you can get the latest syntax
-files from the vim project:
-
- http://ftp.vim.org/pub/vim/runtime/syntax/git.vim
- http://ftp.vim.org/pub/vim/runtime/syntax/gitcommit.vim
- http://ftp.vim.org/pub/vim/runtime/syntax/gitconfig.vim
- http://ftp.vim.org/pub/vim/runtime/syntax/gitrebase.vim
- http://ftp.vim.org/pub/vim/runtime/syntax/gitsendemail.vim
-
-These files are also available via FTP at the same location.
-
-To install:
-
- 1. Copy these files to vim's syntax directory $HOME/.vim/syntax
- 2. To auto-detect the editing of various git-related filetypes:
-
- $ curl http://ftp.vim.org/pub/vim/runtime/filetype.vim |
- sed -ne '/^" Git$/, /^$/ p' >>$HOME/.vim/filetype.vim