mirror of
https://github.com/git/git.git
synced 2024-11-18 03:14:02 +01:00
Merge branch 'master' of .
This commit is contained in:
commit
3db6b224cf
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,6 +31,7 @@ git-fetch-pack
|
||||
git-format-patch
|
||||
git-fsck-objects
|
||||
git-get-tar-commit-id
|
||||
git-grep
|
||||
git-hash-object
|
||||
git-http-fetch
|
||||
git-init-db
|
||||
|
47
Documentation/git-grep.txt
Normal file
47
Documentation/git-grep.txt
Normal 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
git(7)
|
||||
======
|
||||
v0.99.5, Aug 2005
|
||||
v0.99.6, Sep 2005
|
||||
|
||||
NAME
|
||||
----
|
||||
@ -238,7 +238,7 @@ link:git-commit.html[git-commit]::
|
||||
Previously this command was known as git-commit-script.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
link:git-grep.html[git-grep]::
|
||||
Print lines matching a pattern
|
||||
|
||||
link:git-log.html[git-log]::
|
||||
Shows commit logs.
|
||||
Previously this command was known as git-log-script.
|
||||
|
5
INSTALL
5
INSTALL
@ -64,3 +64,8 @@ Issues of note:
|
||||
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
|
||||
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
|
||||
|
2
Makefile
2
Makefile
@ -76,7 +76,7 @@ SCRIPT_SH = \
|
||||
git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
|
||||
git-applymbox.sh git-applypatch.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 = \
|
||||
git-archimport.perl git-cvsimport.perl git-relink.perl \
|
||||
|
11
cache.h
11
cache.h
@ -50,6 +50,17 @@
|
||||
* Your search - "port 9418" - did not match any documents.
|
||||
*
|
||||
* 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
|
||||
|
||||
|
@ -55,6 +55,7 @@ then
|
||||
git-read-tree --reset $new &&
|
||||
git-checkout-index -q -f -u -a
|
||||
else
|
||||
git-update-index --refresh >/dev/null
|
||||
git-read-tree -m -u $old $new
|
||||
fi
|
||||
|
||||
|
@ -10,7 +10,7 @@ URL: http://kernel.org/pub/software/scm/git/
|
||||
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}
|
||||
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
|
||||
This is a stupid (but extremely fast) directory content manager. It
|
||||
@ -40,10 +40,14 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/git-core/templates/*
|
||||
%doc README COPYING Documentation/*.txt
|
||||
%{!?_without_docs: %doc Documentation/*.html }
|
||||
%{!?_without_docs: %{_mandir}/man1/*.1.gz}
|
||||
%{!?_without_docs: %{_mandir}/man7/*.7.gz}
|
||||
%{!?_without_docs: %{_mandir}/man1/*.1*}
|
||||
%{!?_without_docs: %{_mandir}/man7/*.7*}
|
||||
|
||||
%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>
|
||||
- Redid the description
|
||||
- Cut overlong make line, loosened changelog a bit
|
||||
|
@ -27,8 +27,6 @@ with applymbox.
|
||||
}
|
||||
|
||||
diff_opts=
|
||||
IFS='
|
||||
'
|
||||
LF='
|
||||
'
|
||||
|
||||
@ -61,7 +59,10 @@ do
|
||||
--output-directo|--output-director|--output-directory)
|
||||
case "$#" in 1) usage ;; esac; shift
|
||||
outdir="$1" ;;
|
||||
-*) diff_opts="$diff_opts$LF$1" ;;
|
||||
-*' '* | -*"$LF"* | -*' '*)
|
||||
# Ignore diff option that has whitespace for now.
|
||||
;;
|
||||
-*) diff_opts="$diff_opts$1 " ;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
@ -72,16 +73,20 @@ tt)
|
||||
die '--keep-subject and --numbered are incompatible.' ;;
|
||||
esac
|
||||
|
||||
revpair=
|
||||
rev1= rev2=
|
||||
case "$#" in
|
||||
2)
|
||||
revpair="$1..$2" ;;
|
||||
rev1="$1" rev2="$2" ;;
|
||||
1)
|
||||
case "$1" in
|
||||
*..*)
|
||||
revpair="$1";;
|
||||
rev1=`expr "$1" : '\(.*\)\.\.'`
|
||||
rev2=`expr "$1" : '.*\.\.\(.*\)'`
|
||||
;;
|
||||
*)
|
||||
revpair="$1..HEAD";;
|
||||
rev1="$1"
|
||||
rev2="HEAD"
|
||||
;;
|
||||
esac ;;
|
||||
*)
|
||||
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"
|
||||
stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'
|
||||
|
||||
git-rev-list --no-merges --merge-order \
|
||||
$(git-rev-parse --revs-only "$revpair") >$series
|
||||
git-cherry -v "$rev1" "$rev2" |
|
||||
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]"`
|
||||
i=$total
|
||||
i=1
|
||||
while read commit
|
||||
do
|
||||
git-cat-file commit "$commit" | git-stripspace >$commsg
|
||||
@ -145,7 +161,7 @@ do
|
||||
esac
|
||||
|
||||
file=`printf '%04d-%stxt' $i "$title"`
|
||||
i=`expr "$i" - 1`
|
||||
i=`expr "$i" + 1`
|
||||
echo "* $file"
|
||||
{
|
||||
mailScript='
|
||||
|
43
git-grep.sh
Executable file
43
git-grep.sh
Executable 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"
|
@ -1,6 +1,6 @@
|
||||
#!/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 sets import Set
|
||||
|
||||
@ -60,7 +60,7 @@ def merge(h1, h2, branch1Name, branch2Name, graph, callDepth=0):
|
||||
branch1Name, branch2Name,
|
||||
cleanCache, updateWd)
|
||||
|
||||
if clean or alwaysWriteTree:
|
||||
if clean or cleanCache:
|
||||
res = Commit(None, [h1, h2], tree=shaRes)
|
||||
graph.addNode(res)
|
||||
else:
|
||||
@ -120,9 +120,8 @@ def unmergedCacheEntries():
|
||||
e.stages[stage].mode = mode
|
||||
e.stages[stage].sha1 = sha1
|
||||
else:
|
||||
print 'Error: Merge program failed: Unexpected output from', \
|
||||
'git-ls-files:', l
|
||||
sys.exit(2)
|
||||
die('Error: Merge program failed: Unexpected output from', \
|
||||
'git-ls-files:', l)
|
||||
return res
|
||||
|
||||
def mergeTrees(head, merge, common, branch1Name, branch2Name,
|
||||
@ -381,26 +380,25 @@ def processEntry(entry, branch1Name, branch2Name, files, dirs,
|
||||
os.unlink(src1)
|
||||
os.unlink(src2)
|
||||
else:
|
||||
print 'ERROR: Fatal merge failure.'
|
||||
print "ERROR: Shouldn't happen"
|
||||
sys.exit(2)
|
||||
die("ERROR: Fatal merge failure, shouldn't happen.")
|
||||
|
||||
return cleanMerge
|
||||
|
||||
def usage():
|
||||
print 'Usage:', sys.argv[0], ' <base>... -- <head> <remote>..'
|
||||
sys.exit(2)
|
||||
die('Usage:', sys.argv[0], ' <base>... -- <head> <remote>..')
|
||||
|
||||
# main entry point as merge strategy module
|
||||
# The first parameters up to -- are merge bases, and the rest are heads.
|
||||
# This strategy module figures out merge bases itself, so we only
|
||||
# get heads.
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
usage()
|
||||
|
||||
for nextArg in xrange(1, len(sys.argv)):
|
||||
if sys.argv[nextArg] == '--':
|
||||
if len(sys.argv) != nextArg + 3:
|
||||
print 'Not handling anything other than two heads merge.'
|
||||
sys.exit(2)
|
||||
die('Not handling anything other than two heads merge.')
|
||||
try:
|
||||
h1 = firstBranch = sys.argv[nextArg + 1]
|
||||
h2 = secondBranch = sys.argv[nextArg + 2]
|
||||
@ -409,15 +407,20 @@ for nextArg in xrange(1, len(sys.argv)):
|
||||
break
|
||||
|
||||
print 'Merging', h1, 'with', h2
|
||||
h1 = runProgram(['git-rev-parse', '--verify', h1 + '^0']).rstrip()
|
||||
h2 = runProgram(['git-rev-parse', '--verify', h2 + '^0']).rstrip()
|
||||
|
||||
graph = buildGraph([h1, h2])
|
||||
try:
|
||||
h1 = runProgram(['git-rev-parse', '--verify', h1 + '^0']).rstrip()
|
||||
h2 = runProgram(['git-rev-parse', '--verify', h2 + '^0']).rstrip()
|
||||
|
||||
[res, clean] = merge(graph.shaMap[h1], graph.shaMap[h2],
|
||||
firstBranch, secondBranch, graph)
|
||||
graph = buildGraph([h1, h2])
|
||||
|
||||
print ''
|
||||
[res, clean] = merge(graph.shaMap[h1], graph.shaMap[h2],
|
||||
firstBranch, secondBranch, graph)
|
||||
|
||||
print ''
|
||||
except:
|
||||
traceback.print_exc(None, sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
if clean:
|
||||
sys.exit(0)
|
||||
|
@ -10,6 +10,10 @@ if sys.version_info[0] < 2 or \
|
||||
|
||||
import subprocess
|
||||
|
||||
def die(*args):
|
||||
printList(args, sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
# Debugging machinery
|
||||
# -------------------
|
||||
|
||||
@ -28,11 +32,11 @@ def debug(*args):
|
||||
if funcName in functionsToDebug:
|
||||
printList(args)
|
||||
|
||||
def printList(list):
|
||||
def printList(list, file=sys.stdout):
|
||||
for x in list:
|
||||
sys.stdout.write(str(x))
|
||||
sys.stdout.write(' ')
|
||||
sys.stdout.write('\n')
|
||||
file.write(str(x))
|
||||
file.write(' ')
|
||||
file.write('\n')
|
||||
|
||||
# Program execution
|
||||
# -----------------
|
||||
@ -42,6 +46,9 @@ class ProgramError(Exception):
|
||||
self.progStr = progStr
|
||||
self.error = error
|
||||
|
||||
def __str__(self):
|
||||
return self.progStr + ': ' + self.error
|
||||
|
||||
addDebug('runProgram')
|
||||
def runProgram(prog, input=None, returnCode=False, env=None, pipeOutput=True):
|
||||
debug('runProgram prog:', str(prog), 'input:', str(input))
|
||||
|
Loading…
Reference in New Issue
Block a user