code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh # After setting the fake editor with this function, you can # # - override the commit message with $FAKE_COMMIT_MESSAGE # - amend the commit message with $FAKE_COMMIT_AMEND # - check that non-commit messages have a certain line count with $EXPECT_COUNT # - check the commit count in the commit message header ...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Test git config in different settings' . ./test-lib.sh test_expect_success 'clear default config' ' rm -f .git/config ' cat > expect << EOF [core] penguin = little blue EOF test_expect_success 'initial' ' git config core.penguin "little blu...
Shell
#!/bin/sh # # Copyright (c) 2008 Google Inc. # test_description='git-pack-object with missing base ' . ./test-lib.sh # Create A-B chain # test_expect_success \ 'setup base' \ 'for a in a b c d e f g h i; do echo $a >>text; done && echo side >side && git update-index --add text side && A=$(echo...
Shell
#!/bin/sh test_description='test recreated svn branch with empty files' . ./lib-git-svn.sh test_expect_success 'load svn dumpfile' ' svnadmin load "$rawsvnrepo" < "${TEST_DIRECTORY}/t9136/svn.dump" ' test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x' test_done
Shell
#!/bin/sh test_description='checkout switching away from an invalid branch' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git add world && git commit -m initial ' test_expect_success 'checkout should not start branch from a tree' ' test_must_fail git checkout -b newbranch master^{tree} ' t...
Shell
#!/bin/sh # # Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland # test_description='git cherry should detect patches integrated upstream This test cherry-picks one local change of two into master branch, and checks that git cherry only returns the second patch in the local branch ' . ./test-lib.sh GIT...
Shell
#!/bin/sh test_description='git rebase - test patch id computation' . ./test-lib.sh test_set_prereq NOT_EXPENSIVE test -n "$GIT_PATCHID_TIMING_TESTS" && test_set_prereq EXPENSIVE test -x /usr/bin/time && test_set_prereq USR_BIN_TIME count() { i=0 while test $i -lt $1 do echo "$i" i=$(($i+1)) done } scrambl...
Shell
#!/bin/sh test_description='diff with assume-unchanged entries' . ./test-lib.sh # external diff has been tested in t4020-diff-external.sh test_expect_success 'setup' ' echo zero > zero && git add zero && git commit -m zero && echo one > one && echo two > two && git add one two && git commit -m onetwo && git...
Shell
#!/bin/sh test_description='git p4 client view' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # # Verify these files exist, exactly. Caller creates # a list of files in file "files". # check_files_exist() { ok=0 && num=$# && for arg ; do test_path_is_file "$arg" && ok=$(($ok + 1)) done &...
Shell
#!/bin/sh test_description='git commit porcelain-ish' . ./test-lib.sh commit_msg_is () { expect=commit_msg_is.expect actual=commit_msg_is.actual printf "%s" "$(git log --pretty=format:%s%b -1)" >$actual && printf "%s" "$1" >$expect && test_i18ncmp $expect $actual } # Arguments: [<prefix] [<commit message>] [<...
Shell
#!/bin/sh test_description='git merge Testing the resolve strategy.' . ./test-lib.sh test_expect_success 'setup' ' echo c0 > c0.c && git add c0.c && git commit -m c0 && git tag c0 && echo c1 > c1.c && git add c1.c && git commit -m c1 && git tag c1 && git reset --hard c0 && echo c2 > c2.c && git add c2.c ...
Shell
#!/bin/sh test_description='basic git merge-index / git-merge-one-file tests' . ./test-lib.sh test_expect_success 'setup diverging branches' ' for i in 1 2 3 4 5 6 7 8 9 10; do echo $i done >file && git add file && git commit -m base && git tag base && sed s/2/two/ <file >tmp && mv tmp file && git commit -a...
Shell
#!/bin/sh # # Copyright (c) 2012 Peter Baumann # test_description='git svn reset clears memoized caches' . ./lib-git-svn.sh svn_ver="$(svn --version --quiet)" case $svn_ver in 0.* | 1.[0-4].*) skip_all="skipping git-svn test - SVN too old ($svn_ver)" test_done ;; esac # ... a - b - m <- trunk # \ /...
Shell
#!/bin/sh # # Copyright (c) 2007 Junio C Hamano # test_description='git apply --whitespace=strip and configuration file. ' . ./test-lib.sh test_expect_success setup ' mkdir sub && echo A >sub/file1 && cp sub/file1 saved && git add sub/file1 && echo "B " >sub/file1 && git diff >patch.file ' # Also handcraft G...
Shell
#!/bin/sh test_description='credential-cache tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-credential.sh test -z "$NO_UNIX_SOCKETS" || { skip_all='skipping credential-cache tests, unix sockets not available' test_done } # don't leave a stale daemon running trap 'code=$?; git credential-cache exit; (exit $code); d...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Merge base and parent list computation. ' . ./test-lib.sh M=1130000000 Z=+0000 GIT_COMMITTER_EMAIL=git@comm.iter.xz GIT_COMMITTER_NAME='C O Mmiter' GIT_AUTHOR_NAME='A U Thor' GIT_AUTHOR_EMAIL=git@au.thor.xz export GIT_COMMITTER_EMAIL GIT_COMMITTER_...
Shell
#!/bin/sh # Copyright (c) 2011, Google Inc. test_description='adding and checking out large blobs' . ./test-lib.sh test_expect_success setup ' # clone does not allow us to pass core.bigfilethreshold to # new repos, so set core.bigfilethreshold globally git config --global core.bigfilethreshold 200k && echo X | d...
Shell
#!/bin/sh # # Copyright (c) 2008 Deskin Miller # test_description='git svn partial-rebuild tests' . ./lib-git-svn.sh test_expect_success 'initialize svnrepo' ' mkdir import && ( (cd import && mkdir trunk branches tags && (cd trunk && echo foo > foo ) && svn_cmd import -m "import for git-svn" . "$svnrepo...
Shell
#!/bin/sh # Copyright (c) 2011, Google Inc. test_description='diff --stat-count' . ./test-lib.sh test_expect_success 'setup' ' >a && >b && >c && >d && git add a b c d && git commit -m initial ' test_expect_success 'mode-only change show as a 0-line change' ' git reset --hard && test_chmod +x b d && echo a >...
Shell
#!/bin/sh # # this script sets up a Subversion repository for Makefile in the # first ever git merge, as if it were done with svnmerge (SVN 1.5+) # rm -rf foo.svn foo set -e mkdir foo.svn svnadmin create foo.svn svn co file://`pwd`/foo.svn foo commit() { i=$(( $1 + 1 )) shift; svn commit -m "(r$i) $*" >/...
Shell
#!/bin/sh test_description='git p4 label tests' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # Basic p4 label import tests. # test_expect_success 'basic p4 labels' ' test_when_finished cleanup_git && ( cd "$cli" && mkdir -p main && echo f1 >main/f1 && p4 add main/f1 && p4 submit -d ...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong test_description='git svn dcommit clobber series' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' mkdir import && (cd import && awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file svn_cmd import -m "initial" . "$svnrepo" ) && git svn init "$svnrepo" &...
Shell
#!/bin/sh test_description="Tests history walking performance" . ./perf-lib.sh test_perf_default_repo test_perf 'rev-list --all' ' git rev-list --all >/dev/null ' test_perf 'rev-list --all --objects' ' git rev-list --all --objects >/dev/null ' test_done
Shell
#!/bin/sh test_description="git-grep performance in various modes" . ./perf-lib.sh test_perf_large_repo test_checkout_worktree test_perf 'grep worktree, cheap regex' ' git grep some_nonexistent_string || : ' test_perf 'grep worktree, expensive regex' ' git grep "^.* *some_nonexistent_string$" || : ' test_perf 'gr...
Shell
#!/bin/sh case "$1" in --help) echo "usage: $0 [other_git_tree...] [--] [test_scripts]" exit 0 ;; esac die () { echo >&2 "error: $*" exit 1 } run_one_dir () { if test $# -eq 0; then set -- p????-*.sh fi echo "=== Running $# tests in ${GIT_TEST_INSTALLED:-this tree} ===" for t in "$@"; do ./$t $GIT_T...
Shell
#!/bin/sh # # Copyright (c) 2011 Thomas Rast # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is distr...
Shell
#!/bin/sh test_description="Tests diff generation performance" . ./perf-lib.sh test_perf_default_repo test_perf 'log -3000 (baseline)' ' git log -3000 >/dev/null ' test_perf 'log --raw -3000 (tree-only)' ' git log --raw -3000 >/dev/null ' test_perf 'log -p -3000 (Myers)' ' git log -p -3000 >/dev/null ' test_p...
Shell
#!/bin/sh test_description="Tests index-pack performance" . ./perf-lib.sh test_perf_large_repo test_expect_success 'repack' ' git repack -ad && PACK=`ls .git/objects/pack/*.pack | head -n1` && test -f "$PACK" && export PACK ' test_perf 'index-pack 0 threads' ' GIT_DIR=t1 git index-pack --threads=1 --stdin < $...
Shell
#!/bin/sh test_description='Tests whether perf-lib facilities work' . ./perf-lib.sh test_perf_default_repo test_perf 'test_perf_default_repo works' ' foo=$(git rev-parse HEAD) && test_export foo ' test_checkout_worktree test_perf 'test_checkout_worktree works' ' wt=$(find . | wc -l) && idx=$(git ls-files | wc ...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='add -e basic tests' . ./test-lib.sh cat > file << EOF LO, praise of the prowess of people-kings of spear-armed Danes, in days long sped, we have heard, and what honor the athelings won! Oft Scyld the Scefing from squadroned foes, from many a...
Shell
#!/bin/sh # # Copyright (c) 2010 Steven Walter # test_description='git svn merge detection' . ./lib-git-svn.sh svn_ver="$(svn --version --quiet)" case $svn_ver in 0.* | 1.[0-4].*) skip_all="skipping git-svn test - SVN too old ($svn_ver)" test_done ;; esac test_expect_success 'initialize source svn repo' ' svn_cm...
Shell
#!/bin/sh test_description='pulling from symlinked subdir' . ./test-lib.sh # The scenario we are building: # # trash\ directory/ # clone-repo/ # subdir/ # bar # subdir-link -> clone-repo/subdir/ # # The working directory is subdir-link. test_expect_success SYMLINKS setup ' mkdir subdir && ...
Shell
#!/bin/sh test_description='diff with unmerged index entries' . ./test-lib.sh test_expect_success setup ' for i in 0 1 2 3 do blob=$(echo $i | git hash-object --stdin) && eval "blob$i=$blob" && eval "m$i=\"100644 \$blob$i $i\"" || break done && paths= && for b in o x do for o in o x do for t in o x...
Shell
#!/bin/sh test_description='apply with fuzz and offset' . ./test-lib.sh dotest () { name="$1" && shift && test_expect_success "$name" " git checkout-index -f -q -u file && git apply $* && test_cmp expect file " } test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 10 11 12 do echo $i done >file &&...
Shell
#!/bin/sh test_description='checkout into detached HEAD state' . ./test-lib.sh check_detached () { test_must_fail git symbolic-ref -q HEAD >/dev/null } check_not_detached () { git symbolic-ref -q HEAD >/dev/null } PREV_HEAD_DESC='Previous HEAD position was' check_orphan_warning() { test_i18ngrep "you are leaving...
Shell
#!/bin/sh test_description='diff --dirstat tests' . ./test-lib.sh # set up two commits where the second commit has these files # (10 lines in each file): # # unchanged/text (unchanged from 1st commit) # changed/text (changed 1st line) # rearranged/text (swapped 1st and 2nd line) #...
Shell
#!/bin/sh test_description='messages from rebase operation' . ./test-lib.sh quick_one () { echo "$1" >"file$1" && git add "file$1" && test_tick && git commit -m "$1" } test_expect_success setup ' quick_one O && git branch topic && quick_one X && quick_one A && quick_one B && quick_one Y && git checkout ...
Shell
#!/bin/sh # # This is included in commands that either have to be run from the toplevel # of the repository, or with GIT_DIR environment variable properly. # If the GIT_DIR does not look like the right correct git-repository, # it dies. # Having this variable in your environment would break scripts because # you would...
Shell
#!/bin/sh # # git-submodule.sh: add, init, update or list git submodules # # Copyright (c) 2007 Lars Hjemli dashless=$(basename "$0" | sed -e 's/-/ /') USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>] or: $dashless [--quiet] status [--cached] [--r...
Shell
#!/bin/sh # git-difftool--helper is a GIT_EXTERNAL_DIFF-compatible diff tool launcher. # This script is typically launched by using the 'git difftool' # convenience command. # # Copyright (c) 2009, 2010 David Aguilar TOOL_MODE=diff . git-mergetool--lib # difftool.prompt controls the default prompt/no-prompt behavior ...
Shell
#!/bin/sh T="$1" for h in \ *.txt *.html \ howto/*.txt howto/*.html \ technical/*.txt technical/*.html \ RelNotes/*.txt *.css do if test ! -f "$h" then : did not match elif test -f "$T/$h" && $DIFF -u -I'^Last updated ' "$T/$h" "$h" then :; # up to date else echo >&2 "# install $h $T/$h" rm -f "$T/...
Shell
#!/bin/sh cat <<\EOF Git Howto Index =============== Here is a collection of mailing list postings made by various people describing how they use Git in their workflow. EOF for txt do title=`expr "$txt" : '.*/\(.*\)\.txt$'` from=`sed -ne ' /^$/q /^From:[ ]/{ s/// s/^[ ]*// s/[ ]*$// s/^/by / p } ...
Shell
#!/bin/sh # This requires git-manpages and/or git-htmldocs repositories repository=${1?repository} destdir=${2?destination} head=master GIT_DIR= for d in "$repository/.git" "$repository" do if GIT_DIR="$d" git rev-parse refs/heads/master >/dev/null 2>&1 then GIT_DIR="$d" export GIT_DIR break fi done if test...
Shell
#!/bin/sh ( c=//////////////////////////////////////////////////////////////// skel=api-index-skel.txt sed -e '/^\/\/ table of contents begin/q' "$skel" echo "$c" ls api-*.txt | while read filename do case "$filename" in api-index-skel.txt | api-index.txt) continue ;; esac title=$(sed -e 1q "$filename"...
Shell
#!/bin/sh # # This program resolves merge conflicts in git # # Copyright (c) 2006 Theodore Y. Ts'o # # This file is licensed under the GPL v2, or a later version # at the discretion of Junio C Hamano. # USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...' SUBDIRECTORY_OK=Yes OPTIONS_SPEC= ...
Shell
#!/bin/sh dd if=/dev/zero bs=1048576 count=100 2>/dev/null | /usr/bin/time ./test-sha1 >/dev/null while read expect cnt pfx do case "$expect" in '#'*) continue ;; esac actual=` { test -z "$pfx" || echo "$pfx" dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null | perl -pe 'y/\000/g/' } | ./test-sha1 $cnt ...
Shell
#!/bin/sh # Copyright (c) 2007, Nanako Shiraishi dashless=$(basename "$0" | sed -e 's/-/ /') USAGE="list [<options>] or: $dashless show [<stash>] or: $dashless drop [-q|--quiet] [<stash>] or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>] or: $dashless branch <branchname> [<stash>] or: $dash...
Shell
#!/bin/sh # # Copyright (c) 2006 Johannes E. Schindelin # SHORT DESCRIPTION # # This script makes it easy to fix up commits in the middle of a series, # and rearrange commits. # # The original idea comes from Eric W. Biederman, in # http://article.gmane.org/gmane.comp.version-control.git/22407 # # The file containing ...
Shell
#!/bin/sh OPTIONS_KEEPDASHDASH= OPTIONS_SPEC="\ git quiltimport [options] -- n,dry-run dry run author= author name and email address for patches without any patches= path to the quilt series and patches " SUBDIRECTORY_ON=Yes . git-sh-setup dry_run="" quilt_author="" while test $# != 0 do case "$1" in ...
Shell
#!/bin/sh # This script displays the distribution of longest common hash prefixes. # This can be used to determine the minimum prefix length to use # for object names to be unique. git rev-list --objects --all | sort | perl -lne ' substr($_, 40) = ""; # uncomment next line for a distribution of bits instead of he...
Shell
#!/bin/sh # Copyright (c) 2008, Nanako Shiraishi # Prime rerere database from existing merge commits me=rerere-train USAGE="$me rev-list-args" SUBDIRECTORY_OK=Yes OPTIONS_SPEC= . $(git --exec-path)/git-sh-setup require_work_tree cd_to_toplevel # Remember original branch branch=$(git symbolic-ref -q HEAD) || original...
Shell
#!/bin/sh usage () { echo "usage:" $@ exit 127 } die () { echo $@ exit 128 } if test $# -lt 2 || test $# -gt 3 then usage "$0 <repository> <new_workdir> [<branch>]" fi orig_git=$1 new_workdir=$2 branch=$3 # want to make sure that what is pointed to has a .git directory ... git_dir=$(cd "$orig_git" 2>/dev/null...
Shell
#!/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 t...
Shell
#!/bin/sh # # Copyright (c) 2006, Shawn O. Pearce # # Cleanup unreachable files and optimize the repository. USAGE='[--prune]' SUBDIRECTORY_OK=Yes . git-sh-setup no_prune=: while test $# != 0 do case "$1" in --prune) no_prune= ;; --) usage ;; esac shift done case "$(git config --get gc.packrefs)" in not...
Shell
#!/bin/sh OPTIONS_KEEPDASHDASH=t OPTIONS_SPEC="\ git-checkout [options] [<branch>] [<paths>...] -- b= create a new branch started at <branch> l create the new branch's reflog track arrange that the new branch tracks the remote branch f proceed even if the index or working tree is not...
Shell
#!/bin/sh # usage () { echo >&2 "usage: $0 [--heads] [--tags] [-u|--upload-pack <upload-pack>]" echo >&2 " <repository> <refs>..." exit 1; } die () { echo >&2 "$*" exit 1 } exec= while test $# != 0 do case "$1" in -h|--h|--he|--hea|--head|--heads) heads=heads; shift ;; -t|--t|--t...
Shell
#!/bin/sh # # Copyright (c) 2005 Linus Torvalds # Copyright (c) 2006 Junio C Hamano USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--template <file>] [[-i | -o] <path>...]' SUBDIRECTORY_OK=Yes OPTIONS_SPEC= . git-sh-setup re...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # # Pretend we resolved the heads, but declare our tree trumps everybody else. # # We need to exit with 2 if the index does not match our HEAD tree, # because the current index is what we will be committing as the # merge result. git diff-index --quiet --cached HEAD -- ...
Shell
#!/bin/sh USAGE="(edit [-F <file> | -m <msg>] | show) [commit]" . git-sh-setup test -z "$1" && usage ACTION="$1"; shift test -z "$GIT_NOTES_REF" && GIT_NOTES_REF="$(git config core.notesref)" test -z "$GIT_NOTES_REF" && GIT_NOTES_REF="refs/notes/commits" MESSAGE= while test $# != 0 do case "$1" in -m) test "$AC...
Shell
#!/bin/sh # # Copyright (c) 2005 Linus Torvalds # # Resolve two trees. # echo 'WARNING: This command is DEPRECATED and will be removed very soon.' >&2 echo 'WARNING: Please use git-merge or git-pull instead.' >&2 sleep 2 USAGE='<head> <remote> <merge-message>' . git-sh-setup dropheads() { rm -f -- "$GIT_DIR/MERGE_H...
Shell
#!/bin/sh # USAGE='<fetch-options> <repository> <refspec>...' SUBDIRECTORY_OK=Yes . git-sh-setup set_reflog_action "fetch $*" cd_to_toplevel ;# probably unnecessary... . git-parse-remote _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" LF=' ' IFS="$LF" no_tags= tags= a...
Shell
#!/bin/sh USAGE='<tag>' SUBDIRECTORY_OK='Yes' . git-sh-setup verbose= while test $# != 0 do case "$1" in -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose) verbose=t ;; *) break ;; esac shift done if [ "$#" != "1" ] then usage fi type="$(git cat-file -t "$1" 2>/dev/null)" || die "$1: no such object." ...
Shell
#!/bin/sh # # Copyright (c) 2005-2006 Pavel Roskin # OPTIONS_KEEPDASHDASH= OPTIONS_SPEC="\ git-clean [options] <paths>... Clean untracked files from the working directory When optional <paths>... arguments are given, the paths affected are further limited to those that match them. -- d remove directories as well f o...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # OPTIONS_KEEPDASHDASH= OPTIONS_SPEC="\ git merge [options] <remote>... git merge [options] <msg> HEAD <remote> -- stat show a diffstat at the end of the merge n don't show a diffstat at the end of the merge summary (synony...
Shell
#!/bin/sh # # Copyright (c) 2005 Linus Torvalds # Copyright (c) 2005 Junio C Hamano # case "$0" in *-revert* ) test -t 0 && edit=-e replay= me=revert USAGE='[--edit | --no-edit] [-n] <commit-ish>' ;; *-cherry-pick* ) replay=t edit= me=cherry-pick USAGE='[--edit] [-n] [-r] [-x] <commit-ish>' ;; * ) echo >&2 "...
Shell
#!/bin/sh # Copyright (c) 2005 Linus Torvalds USAGE='[-n [<num>]] -l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d | -v] [-m <msg>] <tagname> [<head>]' SUBDIRECTORY_OK='Yes' . git-sh-setup message_given= annotate= signed= force= message= username= list= verify= LINES=0 while test $# != 0 do case "$1" in -a) ...
Shell
#!/bin/sh # # Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano # USAGE='[--mixed | --soft | --hard] [<commit-ish>] [ [--] <paths>...]' SUBDIRECTORY_OK=Yes . git-sh-setup set_reflog_action "reset $*" require_work_tree update= reset_type=--mixed unset rev while test $# != 0 do case "$1" in --mixed | --soft...
Shell
#!/bin/sh # # Copyright (c) 2005, Linus Torvalds # Copyright (c) 2005, Junio C Hamano # # Clone a repository into a different directory that does not yet exist. # See git-sh-setup why. unset CDPATH OPTIONS_SPEC="\ git-clone [options] [--] <repo> [<dir>] -- n,no-checkout don't create a checkout bare ...
Shell
#!/bin/sh USAGE="[-a] [-r] [-m] [-t] [-n] [-b <newname>] <name>" LONG_USAGE="git-resurrect attempts to find traces of a branch tip called <name>, and tries to resurrect it. Currently, the reflog is searched for checkout messages, and with -r also merge messages. With -m and -t, the history of all refs is scanned for...
Shell
#!/bin/sh # Use this tool to rewrite your .git/remotes/ files into the config. . git-sh-setup if [ -d "$GIT_DIR"/remotes ]; then echo "Rewriting $GIT_DIR/remotes" >&2 error=0 # rewrite into config { cd "$GIT_DIR"/remotes ls | while read f; do name=$(printf "$f" | tr -c "A-Za-z0-9-" ".") sed -n \ -e ...
Shell
#!/bin/sh usage() { cat <<\EOF usage: git jump <mode> [<args>] Jump to interesting elements in an editor. The <mode> parameter is one of: diff: elements are diff hunks. Arguments are given to diff. merge: elements are merge conflicts. Arguments are ignored. grep: elements are grep hits. Arguments are given to gre...
Shell
#!/bin/sh if tty -s then echo "Run 'help' for help, or 'exit' to leave. Available commands:" else echo "Run 'help' for help. Available commands:" fi cd "$(dirname "$0")" for cmd in * do case "$cmd" in help) ;; *) [ -f "$cmd" ] && [ -x "$cmd" ] && echo "$cmd" ;; esac done
Shell
#!/bin/sh print_if_bare_repo=' if "$(git --git-dir="$1" rev-parse --is-bare-repository)" = true then printf "%s\n" "${1#./}" fi ' find -type d -name "*.git" -exec sh -c "$print_if_bare_repo" -- \{} \; -prune 2>/dev/null
Shell
#!/bin/sh # Distributed under the terms of the GNU General Public License v2 # Copyright (c) 2006 Fernando J. Pereda <ferdy@gentoo.org> # Copyright (c) 2008 Natanael Copa <natanael.copa@gmail.com> # Copyright (c) 2010 Eric S. Raymond <esr@thyrsus.com> # Assistance and review by Petr Baudis, author of ciabot.pl, # is gr...
Shell
#!/bin/sh # # Copyright (c) 2012 Avery Pennaraum # test_description='Basic porcelain support for subtrees This test verifies the basic operation of the merge, pull, add and split subcommands of git subtree. ' export TEST_DIRECTORY=$(pwd)/../../../t . ../../../t/test-lib.sh create() { echo "$1" >"$1" git add "$1" ...
Shell
#!/bin/bash # # git-subtree.sh: split/join git repositories in subdirectories of this one # # Copyright (C) 2009 Avery Pennarun <apenwarr@gmail.com> # if [ $# -eq 0 ]; then set -- -h fi OPTS_SPEC="\ git subtree add --prefix=<prefix> <commit> git subtree add --prefix=<prefix> <repository> <commit> git subtree me...
Shell
#!/bin/sh # Copyright 2008 Lukas Sandström <luksan@gmail.com> # # AppendPatch - A script to be used together with ExternalEditor # for Mozilla Thunderbird to properly include patches inline in e-mails. # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2 CONFFILE=~/.appprc SEP="-=-=-=-=-=-...
Shell
#!/bin/sh # # Copyright (c) 2012 Felipe Contreras # test_description='Test remote-bzr' . ./test-lib.sh if ! test_have_prereq PYTHON; then skip_all='skipping remote-bzr tests; python not available' test_done fi if ! "$PYTHON_PATH" -c 'import bzrlib'; then skip_all='skipping remote-bzr tests; bzr not available' t...
Shell
#!/bin/sh # # Copyright (c) 2012 Felipe Contreras # # Base commands from hg-git tests: # https://bitbucket.org/durin42/hg-git/src # test_description='Test remote-hg output compared to hg-git' . ./test-lib.sh if ! test_have_prereq PYTHON; then skip_all='skipping remote-hg tests; python not available' test_done fi ...
Shell
#!/bin/sh # # Copyright (c) 2012 Felipe Contreras # # Base commands from hg-git tests: # https://bitbucket.org/durin42/hg-git/src # test_description='Test remote-hg' . ./test-lib.sh if ! test_have_prereq PYTHON; then skip_all='skipping remote-hg tests; python not available' test_done fi if ! "$PYTHON_PATH" -c 'im...
Shell
#!/bin/sh # # Copyright (c) 2012 Felipe Contreras # # Base commands from hg-git tests: # https://bitbucket.org/durin42/hg-git/src # test_description='Test bidirectionality of remote-hg' . ./test-lib.sh if ! test_have_prereq PYTHON; then skip_all='skipping remote-hg tests; python not available' test_done fi if ! "...
Shell
#!/bin/sh # # Performs an initial import of a directory. This is the equivalent # of doing 'git init; git add .; git commit'. It's a lot slower, # but is meant to be a simple fast-import example. if [ -z "$1" -o -z "$2" ]; then echo "Usage: git-import branch import-message" exit 1 fi USERNAME="$(git config user.nam...
Shell
#!/bin/sh # # Copyright (C) 2012 # Charles Roussel <charles.roussel@ensimag.imag.fr> # Simon Cathebras <simon.cathebras@ensimag.imag.fr> # Julien Khayat <julien.khayat@ensimag.imag.fr> # Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr> # Simon Perrat <simon.perrat@ensimag.imag.fr> # # License: GPL ...
Shell
#!/bin/sh # # Copyright (C) 2012 # Charles Roussel <charles.roussel@ensimag.imag.fr> # Simon Cathebras <simon.cathebras@ensimag.imag.fr> # Julien Khayat <julien.khayat@ensimag.imag.fr> # Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr> # Simon Perrat <simon.perrat@ensimag.imag.fr> # # License: GPL ...
Shell
#!/bin/sh test_description='Test the Git Mediawiki remote helper: git pull by revision' . ./test-gitmw-lib.sh . ./push-pull-tests.sh . $TEST_DIRECTORY/test-lib.sh test_check_precond test_expect_success 'configuration' ' git config --global mediawiki.fetchStrategy by_rev ' test_push_pull test_done
Shell
#!/bin/sh # # Copyright (C) 2012 # Charles Roussel <charles.roussel@ensimag.imag.fr> # Simon Cathebras <simon.cathebras@ensimag.imag.fr> # Julien Khayat <julien.khayat@ensimag.imag.fr> # Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr> # Simon Perrat <simon.perrat@ensimag.imag.fr> # # License: GPL ...
Shell
test_push_pull () { test_expect_success 'Git pull works after adding a new wiki page' ' wiki_reset && git clone mediawiki::'"$WIKI_URL"' mw_dir_1 && wiki_editpage Foo "page created after the git clone" false && ( cd mw_dir_1 && git pull ) && wiki_getallpage ref_page_1 && test_diff_directories m...
Shell
#!/bin/sh # This script installs or deletes a MediaWiki on your computer. # It requires a web server with PHP and SQLite running. In addition, if you # do not have MediaWiki sources on your computer, the option 'install' # downloads them for you. # Please set the CONFIGURATION VARIABLES in ./test-gitmw-lib.sh WIKI_TE...
Shell
# Copyright (C) 2012 # Charles Roussel <charles.roussel@ensimag.imag.fr> # Simon Cathebras <simon.cathebras@ensimag.imag.fr> # Julien Khayat <julien.khayat@ensimag.imag.fr> # Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr> # Simon Perrat <simon.perrat@ensimag.imag.fr> # License: GPL v2 or later #...
Shell
#!/bin/sh # # Copyright (C) 2012 # Charles Roussel <charles.roussel@ensimag.imag.fr> # Simon Cathebras <simon.cathebras@ensimag.imag.fr> # Julien Khayat <julien.khayat@ensimag.imag.fr> # Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr> # Simon Perrat <simon.perrat@ensimag.imag.fr> # # License: GPL ...
Shell
#!bash # # bash/zsh completion support for core Git. # # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). # Distributed under the GNU General Public License, version 2.0. # # The contained completion routines provide support for completi...
Shell
#compdef git gitk # zsh completion wrapper for git # # You need git's bash completion script installed somewhere, by default on the # same directory as this script. # # If your script is on ~/.git-completion.sh instead, you can configure it on # your ~/.zshrc: # # zstyle ':completion:*:*:git:*' script ~/.git-completi...
Shell
# bash/zsh git prompt support # # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> # Distributed under the GNU General Public License, version 2.0. # # This script allows you to see the current branch in your prompt. # # To enable: # # 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). # 2) Add ...
Shell
#!/bin/sh # # An example hook script to verify if you are on battery, in case you # are running Linux or OS X. Called by git-gc --auto with no arguments. # The hook should exit with non-zero status after issuing an appropriate # message if it wants to stop the auto repacking. # # This hook is stored in the contrib/hook...
Shell
#!/bin/sh # # Copyright (c) 2007 Andy Parkins # # An example hook script to mail out commit update information. This hook # sends emails listing new revisions to the repository introduced by the # change being reported. The rule is that (for branch updates) each commit # will appear on one email and one email only. #...
Shell
#!/bin/sh # git-ls-remote could be called from outside a git managed repository; # this would fail in that case and would issue an error message. GIT_DIR=$(git rev-parse -q --git-dir) || :; get_default_remote () { curr_branch=$(git symbolic-ref -q HEAD) curr_branch="${curr_branch#refs/heads/}" origin=$(git config ...
Shell
#!/bin/sh # git-mergetool--lib is a library for common merge tool functions : ${MERGE_TOOLS_DIR=$(git --exec-path)/mergetools} mode_ok () { if diff_mode then can_diff elif merge_mode then can_merge else false fi } is_available () { merge_tool_path=$(translate_merge_tool_path "$1") && type "$merge_tool_...
Shell
#!/bin/sh echo >&2 "fatal: git was built without support for `basename $0` (@@REASON@@)." exit 128
Shell
#!/bin/sh # # Copyright (c) 2005 Linus Torvalds # Copyright (c) 2005 Junio C Hamano # # Resolve two trees, using enhanced multi-base read-tree. # The first parameters up to -- are merge bases; the rest are heads. bases= head= remotes= sep_seen= for arg do case ",$sep_seen,$head,$arg," in *,--,) sep_seen=yes ;; ...
Shell
#!/bin/sh # # Rewrite revision history # Copyright (c) Petr Baudis, 2006 # Minimal changes to "port" it to core-git (c) Johannes Schindelin, 2007 # # Lets you rewrite the revision history of the current branch, creating # a new branch. You can specify a number of filters to modify the commits, # files and trees. # The...
Shell