Merge branch 'master' of .

This commit is contained in:
Junio C Hamano 2005-09-12 22:02:42 -07:00
commit 3db6b224cf
12 changed files with 181 additions and 40 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ git-fetch-pack
git-format-patch git-format-patch
git-fsck-objects git-fsck-objects
git-get-tar-commit-id git-get-tar-commit-id
git-grep
git-hash-object git-hash-object
git-http-fetch git-http-fetch
git-init-db git-init-db

View File

@ -0,0 +1,47 @@
git-grep(1)
===========
v0.99.6, Sep 2005
NAME
----
git-grep - print lines matching a pattern
SYNOPSIS
--------
'git-grep' <option>... <pattern> <path>...
DESCRIPTION
-----------
Searches list of files `git-ls-files` produces for lines
containing a match to the given pattern.
OPTIONS
-------
<option>...::
Either an option to pass to `grep` or `git-ls-files`.
Some `grep` options, such as `-C` and `-m`, that take
parameters are known to `git-grep`.
<pattern>::
The pattern to look for.
<path>...::
Optional paths to limit the set of files to be searched;
passed to `git-ls-files`.
Author
------
Written by Linus Torvalds <torvalds@osdl.org>
Documentation
--------------
Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
GIT
---
Part of the link:git.html[git] suite

View File

@ -1,6 +1,6 @@
git(7) git(7)
====== ======
v0.99.5, Aug 2005 v0.99.6, Sep 2005
NAME NAME
---- ----
@ -238,7 +238,7 @@ link:git-commit.html[git-commit]::
Previously this command was known as git-commit-script. Previously this command was known as git-commit-script.
link:git-diff.html[git-diff]:: link:git-diff.html[git-diff]::
git-diff. Show changes between commits, commit and working tree, etc.
Previously this command was known as git-diff-script. Previously this command was known as git-diff-script.
link:git-fetch.html[git-fetch]:: link:git-fetch.html[git-fetch]::
@ -246,9 +246,12 @@ link:git-fetch.html[git-fetch]::
Previously this command was known as git-fetch-script. Previously this command was known as git-fetch-script.
link:git-format-patch.html[git-format-patch]:: link:git-format-patch.html[git-format-patch]::
git-format-patch. Prepare patches for e-mail submission.
Previously this command was known as git-format-patch-script. Previously this command was known as git-format-patch-script.
link:git-grep.html[git-grep]::
Print lines matching a pattern
link:git-log.html[git-log]:: link:git-log.html[git-log]::
Shows commit logs. Shows commit logs.
Previously this command was known as git-log-script. Previously this command was known as git-log-script.

View File

@ -64,3 +64,8 @@ Issues of note:
You'll only need the merge program if you do development using You'll only need the merge program if you do development using
git, and if you only use git to track other peoples work you'll git, and if you only use git to track other peoples work you'll
never notice the lack of it. never notice the lack of it.
- "wish", the TCL/Tk windowing shell is used in gitk to show the
history graphically
- "ssh" is used to push and pull over the net

View File

@ -76,7 +76,7 @@ SCRIPT_SH = \
git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \ git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
git-applymbox.sh git-applypatch.sh \ git-applymbox.sh git-applypatch.sh \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
git-merge-resolve.sh git-merge-resolve.sh git-grep.sh
SCRIPT_PERL = \ SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \ git-archimport.perl git-cvsimport.perl git-relink.perl \

11
cache.h
View File

@ -50,6 +50,17 @@
* Your search - "port 9418" - did not match any documents. * Your search - "port 9418" - did not match any documents.
* *
* as www.google.com puts it. * as www.google.com puts it.
*
* This port has been properly assigned for git use by IANA:
* git (Assigned-9418) [I06-050728-0001].
*
* git 9418/tcp git pack transfer service
* git 9418/udp git pack transfer service
*
* with Linus Torvalds <torvalds@osdl.org> as the point of
* contact. September 2005.
*
* See http://www.iana.org/assignments/port-numbers
*/ */
#define DEFAULT_GIT_PORT 9418 #define DEFAULT_GIT_PORT 9418

View File

@ -55,6 +55,7 @@ then
git-read-tree --reset $new && git-read-tree --reset $new &&
git-checkout-index -q -f -u -a git-checkout-index -q -f -u -a
else else
git-update-index --refresh >/dev/null
git-read-tree -m -u $old $new git-read-tree -m -u $old $new
fi fi

View File

@ -10,7 +10,7 @@ URL: http://kernel.org/pub/software/scm/git/
Source: http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz Source: http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz
BuildRequires: zlib-devel, openssl-devel, curl-devel %{!?_without_docs:, xmlto, asciidoc > 6.0.3} BuildRequires: zlib-devel, openssl-devel, curl-devel %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: sh-utils, diffutils, rsync, rcs, python >= 2.4 Requires: sh-utils, curl, diffutils, rsync, rcs, openssh-clients, perl, python >= 2.4, tk
%description %description
This is a stupid (but extremely fast) directory content manager. It This is a stupid (but extremely fast) directory content manager. It
@ -40,10 +40,14 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/git-core/templates/* %{_datadir}/git-core/templates/*
%doc README COPYING Documentation/*.txt %doc README COPYING Documentation/*.txt
%{!?_without_docs: %doc Documentation/*.html } %{!?_without_docs: %doc Documentation/*.html }
%{!?_without_docs: %{_mandir}/man1/*.1.gz} %{!?_without_docs: %{_mandir}/man1/*.1*}
%{!?_without_docs: %{_mandir}/man7/*.7.gz} %{!?_without_docs: %{_mandir}/man7/*.7*}
%changelog %changelog
* Sun Sep 11 2005 Horst H. von Brand <vonbrand@inf.utfsm.cl>
- Updated dependencies
- Don't assume manpages are gzipped
* Sun Aug 07 2005 Horst H. von Brand <vonbrand@inf.utfsm.cl> * Sun Aug 07 2005 Horst H. von Brand <vonbrand@inf.utfsm.cl>
- Redid the description - Redid the description
- Cut overlong make line, loosened changelog a bit - Cut overlong make line, loosened changelog a bit

View File

@ -27,8 +27,6 @@ with applymbox.
} }
diff_opts= diff_opts=
IFS='
'
LF=' LF='
' '
@ -61,7 +59,10 @@ do
--output-directo|--output-director|--output-directory) --output-directo|--output-director|--output-directory)
case "$#" in 1) usage ;; esac; shift case "$#" in 1) usage ;; esac; shift
outdir="$1" ;; outdir="$1" ;;
-*) diff_opts="$diff_opts$LF$1" ;; -*' '* | -*"$LF"* | -*' '*)
# Ignore diff option that has whitespace for now.
;;
-*) diff_opts="$diff_opts$1 " ;;
*) break ;; *) break ;;
esac esac
shift shift
@ -72,16 +73,20 @@ tt)
die '--keep-subject and --numbered are incompatible.' ;; die '--keep-subject and --numbered are incompatible.' ;;
esac esac
revpair= rev1= rev2=
case "$#" in case "$#" in
2) 2)
revpair="$1..$2" ;; rev1="$1" rev2="$2" ;;
1) 1)
case "$1" in case "$1" in
*..*) *..*)
revpair="$1";; rev1=`expr "$1" : '\(.*\)\.\.'`
rev2=`expr "$1" : '.*\.\.\(.*\)'`
;;
*) *)
revpair="$1..HEAD";; rev1="$1"
rev2="HEAD"
;;
esac ;; esac ;;
*) *)
usage ;; usage ;;
@ -127,10 +132,21 @@ _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" _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d' stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'
git-rev-list --no-merges --merge-order \ git-cherry -v "$rev1" "$rev2" |
$(git-rev-parse --revs-only "$revpair") >$series while read sign rev comment
do
case "$sign" in
'-')
echo >&2 "Merged already: $comment"
;;
*)
echo $rev
;;
esac
done >$series
total=`wc -l <$series | tr -dc "[0-9]"` total=`wc -l <$series | tr -dc "[0-9]"`
i=$total i=1
while read commit while read commit
do do
git-cat-file commit "$commit" | git-stripspace >$commsg git-cat-file commit "$commit" | git-stripspace >$commsg
@ -145,7 +161,7 @@ do
esac esac
file=`printf '%04d-%stxt' $i "$title"` file=`printf '%04d-%stxt' $i "$title"`
i=`expr "$i" - 1` i=`expr "$i" + 1`
echo "* $file" echo "* $file"
{ {
mailScript=' mailScript='

43
git-grep.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
#
# Copyright (c) Linus Torvalds, 2005
#
pattern=
flags=()
git_flags=()
while : ; do
case "$1" in
--cached|--deleted|--others|--killed|\
--ignored|--exclude=*|\
--exclude-from=*|\--exclude-per-directory=*)
git_flags=("${git_flags[@]}" "$1")
;;
-e)
pattern="$2"
shift
;;
-A|-B|-C|-D|-d|-f|-m)
flags=("${flags[@]}" "$1" "$2")
shift
;;
--)
# The rest are git-ls-files paths (or flags)
shift
break
;;
-*)
flags=("${flags[@]}" "$1")
;;
*)
if [ -z "$pattern" ]; then
pattern="$1"
shift
fi
break
;;
esac
shift
done
git-ls-files -z "${git_flags[@]}" "$@" |
xargs -0 grep "${flags[@]}" "$pattern"

View File

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
import sys, math, random, os, re, signal, tempfile, stat, errno import sys, math, random, os, re, signal, tempfile, stat, errno, traceback
from heapq import heappush, heappop from heapq import heappush, heappop
from sets import Set from sets import Set
@ -60,7 +60,7 @@ def merge(h1, h2, branch1Name, branch2Name, graph, callDepth=0):
branch1Name, branch2Name, branch1Name, branch2Name,
cleanCache, updateWd) cleanCache, updateWd)
if clean or alwaysWriteTree: if clean or cleanCache:
res = Commit(None, [h1, h2], tree=shaRes) res = Commit(None, [h1, h2], tree=shaRes)
graph.addNode(res) graph.addNode(res)
else: else:
@ -120,9 +120,8 @@ def unmergedCacheEntries():
e.stages[stage].mode = mode e.stages[stage].mode = mode
e.stages[stage].sha1 = sha1 e.stages[stage].sha1 = sha1
else: else:
print 'Error: Merge program failed: Unexpected output from', \ die('Error: Merge program failed: Unexpected output from', \
'git-ls-files:', l 'git-ls-files:', l)
sys.exit(2)
return res return res
def mergeTrees(head, merge, common, branch1Name, branch2Name, def mergeTrees(head, merge, common, branch1Name, branch2Name,
@ -381,26 +380,25 @@ def processEntry(entry, branch1Name, branch2Name, files, dirs,
os.unlink(src1) os.unlink(src1)
os.unlink(src2) os.unlink(src2)
else: else:
print 'ERROR: Fatal merge failure.' die("ERROR: Fatal merge failure, shouldn't happen.")
print "ERROR: Shouldn't happen"
sys.exit(2)
return cleanMerge return cleanMerge
def usage(): def usage():
print 'Usage:', sys.argv[0], ' <base>... -- <head> <remote>..' die('Usage:', sys.argv[0], ' <base>... -- <head> <remote>..')
sys.exit(2)
# main entry point as merge strategy module # main entry point as merge strategy module
# The first parameters up to -- are merge bases, and the rest are heads. # The first parameters up to -- are merge bases, and the rest are heads.
# This strategy module figures out merge bases itself, so we only # This strategy module figures out merge bases itself, so we only
# get heads. # get heads.
if len(sys.argv) < 4:
usage()
for nextArg in xrange(1, len(sys.argv)): for nextArg in xrange(1, len(sys.argv)):
if sys.argv[nextArg] == '--': if sys.argv[nextArg] == '--':
if len(sys.argv) != nextArg + 3: if len(sys.argv) != nextArg + 3:
print 'Not handling anything other than two heads merge.' die('Not handling anything other than two heads merge.')
sys.exit(2)
try: try:
h1 = firstBranch = sys.argv[nextArg + 1] h1 = firstBranch = sys.argv[nextArg + 1]
h2 = secondBranch = sys.argv[nextArg + 2] h2 = secondBranch = sys.argv[nextArg + 2]
@ -409,6 +407,8 @@ for nextArg in xrange(1, len(sys.argv)):
break break
print 'Merging', h1, 'with', h2 print 'Merging', h1, 'with', h2
try:
h1 = runProgram(['git-rev-parse', '--verify', h1 + '^0']).rstrip() h1 = runProgram(['git-rev-parse', '--verify', h1 + '^0']).rstrip()
h2 = runProgram(['git-rev-parse', '--verify', h2 + '^0']).rstrip() h2 = runProgram(['git-rev-parse', '--verify', h2 + '^0']).rstrip()
@ -418,6 +418,9 @@ graph = buildGraph([h1, h2])
firstBranch, secondBranch, graph) firstBranch, secondBranch, graph)
print '' print ''
except:
traceback.print_exc(None, sys.stderr)
sys.exit(2)
if clean: if clean:
sys.exit(0) sys.exit(0)

View File

@ -10,6 +10,10 @@ if sys.version_info[0] < 2 or \
import subprocess import subprocess
def die(*args):
printList(args, sys.stderr)
sys.exit(2)
# Debugging machinery # Debugging machinery
# ------------------- # -------------------
@ -28,11 +32,11 @@ def debug(*args):
if funcName in functionsToDebug: if funcName in functionsToDebug:
printList(args) printList(args)
def printList(list): def printList(list, file=sys.stdout):
for x in list: for x in list:
sys.stdout.write(str(x)) file.write(str(x))
sys.stdout.write(' ') file.write(' ')
sys.stdout.write('\n') file.write('\n')
# Program execution # Program execution
# ----------------- # -----------------
@ -42,6 +46,9 @@ class ProgramError(Exception):
self.progStr = progStr self.progStr = progStr
self.error = error self.error = error
def __str__(self):
return self.progStr + ': ' + self.error
addDebug('runProgram') addDebug('runProgram')
def runProgram(prog, input=None, returnCode=False, env=None, pipeOutput=True): def runProgram(prog, input=None, returnCode=False, env=None, pipeOutput=True):
debug('runProgram prog:', str(prog), 'input:', str(input)) debug('runProgram prog:', str(prog), 'input:', str(input))