Browse Source

Merge branch 'sp/keep-pack' into np/index-pack

* sp/keep-pack: (29 commits)
  Remove unused variable in receive-pack.
  Teach git-index-pack how to keep a pack file.
  Only repack active packs by skipping over kept packs.
  Allow short pack names to git-pack-objects --unpacked=.
  git-send-email: Read the default SMTP server from the GIT config file
  git-send-email: Document support for local sendmail instead of SMTP server
  Swap the porcelain and plumbing commands in the git man page
  Mention that pull can work locally in the synopsis
  gitweb: Add "next" link to commitdiff view
  gitweb: Move git_get_last_activity subroutine earlier
  Documentation: fix git-format-patch mark-up and link it from git.txt
  Documentation: Update information about <format> in git-for-each-ref
  Bash completion support for aliases
  gitweb: Fix up bogus $stylesheet declarations
  tests: merge-recursive is usable without Python
  gitweb: Check git base URLs before generating URL from it
  Documentation: add git in /etc/services.
  Documentation: add upload-archive service to git-daemon.
  git-cherry: document limit and add diagram
  diff-format.txt: Correct information about pathnames quoting in patch format
  ...
maint
Junio C Hamano 19 years ago
parent
commit
aac91b7eea
  1. 82
      Documentation/diff-format.txt
  2. 54
      Documentation/everyday.txt
  3. 19
      Documentation/git-cherry.txt
  4. 18
      Documentation/git-daemon.txt
  5. 10
      Documentation/git-for-each-ref.txt
  6. 24
      Documentation/git-index-pack.txt
  7. 2
      Documentation/git-pull.txt
  8. 25
      Documentation/git-rev-parse.txt
  9. 9
      Documentation/git-send-email.txt
  10. 363
      Documentation/git.txt
  11. 58
      combine-diff.c
  12. 29
      contrib/completion/git-completion.bash
  13. 27
      git-repack.sh
  14. 3
      git-send-email.perl
  15. 106
      gitweb/gitweb.perl
  16. 43
      index-pack.c
  17. 7
      receive-pack.c
  18. 20
      sha1_file.c
  19. 5
      t/t3401-rebase-partial.sh
  20. 6
      t/t3402-rebase-merge.sh
  21. 6
      t/t3403-rebase-skip.sh
  22. 6
      t/t6021-merge-criss-cross.sh
  23. 6
      t/t6022-merge-rename.sh
  24. 14
      wt-status.c

82
Documentation/diff-format.txt

@ -144,8 +144,10 @@ the file that rename/copy produces, respectively. @@ -144,8 +144,10 @@ the file that rename/copy produces, respectively.
dissimilarity index <number>
index <hash>..<hash> <mode>

3. TAB, LF, and backslash characters in pathnames are
represented as `\t`, `\n`, and `\\`, respectively.
3. TAB, LF, double quote and backslash characters in pathnames
are represented as `\t`, `\n`, `\"` and `\\`, respectively.
If there is need for such substitution then the whole
pathname is put in double quotes.


combined diff format
@ -156,31 +158,91 @@ to produce 'combined diff', which looks like this: @@ -156,31 +158,91 @@ to produce 'combined diff', which looks like this:

------------
diff --combined describe.c
@@@ +98,7 @@@
return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
index fabadb8,cc95eb0..4866510
--- a/describe.c
+++ b/describe.c
@@@ -98,20 -98,12 +98,20 @@@
return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
}

- static void describe(char *arg)
-static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
{
+ unsigned char sha1[20];
+ struct commit *cmit;
+ unsigned char sha1[20];
+ struct commit *cmit;
struct commit_list *list;
static int initialized = 0;
struct commit_name *n;
+ if (get_sha1(arg, sha1) < 0)
+ usage(describe_usage);
+ cmit = lookup_commit_reference(sha1);
+ if (!cmit)
+ usage(describe_usage);
+
if (!initialized) {
initialized = 1;
for_each_ref(get_name);
------------

1. It is preceded with a "git diff" header, that looks like
this (when '-c' option is used):

diff --combined file
+
or like this (when '--cc' option is used):

diff --c file

2. It is followed by one or more extended header lines
(this example shows a merge with two parents):

index <hash>,<hash>..<hash>
mode <mode>,<mode>..<mode>
new file mode <mode>
deleted file mode <mode>,<mode>
+
The `mode <mode>,<mode>..<mode>` line appears only if at least one of
the <mode> is diferent from the rest. Extended headers with
information about detected contents movement (renames and
copying detection) are designed to work with diff of two
<tree-ish> and are not used by combined diff format.

3. It is followed by two-line from-file/to-file header

--- a/file
+++ b/file
+
Similar to two-line header for traditional 'unified' diff
format, `/dev/null` is used to signal created or deleted
files.

4. Chunk header format is modified to prevent people from
accidentally feeding it to `patch -p1`. Combined diff format
was created for review of merge commit changes, and was not
meant for apply. The change is similar to the change in the
extended 'index' header:

@@@ <from-file-range> <from-file-range> <to-file-range> @@@
+
There are (number of parents + 1) `@` characters in the chunk
header for combined diff format.

Unlike the traditional 'unified' diff format, which shows two
files A and B with a single column that has `-` (minus --
appears in A but removed in B), `+` (plus -- missing in A but
added to B), or ` ` (space -- unchanged) prefix, this format
added to B), or `" "` (space -- unchanged) prefix, this format
compares two or more files file1, file2,... with one file X, and
shows how X differs from each of fileN. One column for each of
fileN is prepended to the output line to note how X's line is
different from it.

A `-` character in the column N means that the line appears in
fileN but it does not appear in the last file. A `+` character
fileN but it does not appear in the result. A `+` character
in the column N means that the line appears in the last file,
and fileN does not have that line.
and fileN does not have that line (in other words, the line was
added, from the point of view of that parent).

In the above example output, the function signature was changed
from both files (hence two `-` removals from both file1 and

54
Documentation/everyday.txt

@ -1,22 +1,7 @@ @@ -1,22 +1,7 @@
Everyday GIT With 20 Commands Or So
===================================

GIT suite has over 100 commands, and the manual page for each of
them discusses what the command does and how it is used in
detail, but until you know what command should be used in order
to achieve what you want to do, you cannot tell which manual
page to look at, and if you know that already you do not need
the manual.

Does that mean you need to know all of them before you can use
git? Not at all. Depending on the role you play, the set of
commands you need to know is slightly different, but in any case
what you need to learn is far smaller than the full set of
commands to carry out your day-to-day work. This document is to
serve as a cheat-sheet and a set of pointers for people playing
various roles.

<<Basic Repository>> commands are needed by people who has a
<<Basic Repository>> commands are needed by people who have a
repository --- that is everybody, because every working tree of
git is a repository.

@ -25,28 +10,27 @@ essential for anybody who makes a commit, even for somebody who @@ -25,28 +10,27 @@ essential for anybody who makes a commit, even for somebody who
works alone.

If you work with other people, you will need commands listed in
<<Individual Developer (Participant)>> section as well.
the <<Individual Developer (Participant)>> section as well.

People who play <<Integrator>> role need to learn some more
People who play the <<Integrator>> role need to learn some more
commands in addition to the above.

<<Repository Administration>> commands are for system
administrators who are responsible to care and feed git
repositories to support developers.
administrators who are responsible for the care and feeding
of git repositories.


Basic Repository[[Basic Repository]]
------------------------------------

Everybody uses these commands to feed and care git repositories.
Everybody uses these commands to maintain git repositories.

* gitlink:git-init-db[1] or gitlink:git-clone[1] to create a
new repository.

* gitlink:git-fsck-objects[1] to validate the repository.
* gitlink:git-fsck-objects[1] to check the repository for errors.

* gitlink:git-prune[1] to garbage collect cruft in the
repository.
* gitlink:git-prune[1] to remove unused objects in the repository.

* gitlink:git-repack[1] to pack loose objects for efficiency.

@ -78,8 +62,8 @@ $ git repack -a -d <1> @@ -78,8 +62,8 @@ $ git repack -a -d <1>
$ git prune
------------
+
<1> pack all the objects reachable from the refs into one pack
and remove unneeded other packs
<1> pack all the objects reachable from the refs into one pack,
then remove the other packs.


Individual Developer (Standalone)[[Individual Developer (Standalone)]]
@ -93,9 +77,6 @@ following commands. @@ -93,9 +77,6 @@ following commands.

* gitlink:git-log[1] to see what happened.

* gitlink:git-whatchanged[1] to find out where things have
come from.

* gitlink:git-checkout[1] and gitlink:git-branch[1] to switch
branches.

@ -120,7 +101,7 @@ following commands. @@ -120,7 +101,7 @@ following commands.
Examples
~~~~~~~~

Extract a tarball and create a working tree and a new repository to keep track of it.::
Use a tarball as a starting point for a new repository:
+
------------
$ tar zxf frotz.tar.gz
@ -203,7 +184,7 @@ $ cd my2.6 @@ -203,7 +184,7 @@ $ cd my2.6
$ edit/compile/test; git commit -a -s <1>
$ git format-patch origin <2>
$ git pull <3>
$ git whatchanged -p ORIG_HEAD.. arch/i386 include/asm-i386 <4>
$ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <4>
$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5>
$ git reset --hard ORIG_HEAD <6>
$ git prune <7>
@ -372,12 +353,19 @@ example of managing a shared central repository. @@ -372,12 +353,19 @@ example of managing a shared central repository.

Examples
~~~~~~~~
We assume the following in /etc/services::
+
------------
$ grep 9418 /etc/services
git 9418/tcp # Git Version Control System
------------

Run git-daemon to serve /pub/scm from inetd.::
+
------------
$ grep git /etc/inetd.conf
git stream tcp nowait nobody \
/usr/bin/git-daemon git-daemon --inetd --syslog --export-all /pub/scm
/usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm
------------
+
The actual configuration line should be on one line.
@ -397,7 +385,7 @@ service git @@ -397,7 +385,7 @@ service git
wait = no
user = nobody
server = /usr/bin/git-daemon
server_args = --inetd --syslog --export-all --base-path=/pub/scm
server_args = --inetd --export-all --base-path=/pub/scm
log_on_failure += USERID
}
------------

19
Documentation/git-cherry.txt

@ -7,7 +7,7 @@ git-cherry - Find commits not merged upstream @@ -7,7 +7,7 @@ git-cherry - Find commits not merged upstream

SYNOPSIS
--------
'git-cherry' [-v] <upstream> [<head>]
'git-cherry' [-v] <upstream> [<head>] [<limit>]

DESCRIPTION
-----------
@ -18,7 +18,22 @@ Every commit that doesn't exist in the <upstream> branch @@ -18,7 +18,22 @@ Every commit that doesn't exist in the <upstream> branch
has its id (sha1) reported, prefixed by a symbol. The ones that have
equivalent change already
in the <upstream> branch are prefixed with a minus (-) sign, and those
that only exist in the <head> branch are prefixed with a plus (+) symbol.
that only exist in the <head> branch are prefixed with a plus (+) symbol:

__*__*__*__*__> <upstream>
/
fork-point
\__+__+__-__+__+__-__+__> <head>


If a <limit> has been given then the commits along the <head> branch up
to and including <limit> are not reported:

__*__*__*__*__> <upstream>
/
fork-point
\__*__*__<limit>__-__+__> <head>


Because git-cherry compares the changeset rather than the commit id
(sha1), you can use git-cherry to find out if a commit you made locally

18
Documentation/git-daemon.txt

@ -37,6 +37,8 @@ from `git-fetch`, `git-ls-remote`, and `git-clone`. @@ -37,6 +37,8 @@ from `git-fetch`, `git-ls-remote`, and `git-clone`.
This is ideally suited for read-only updates, i.e., pulling from
git repositories.

An `upload-archive` also exists to serve `git-archive`.

OPTIONS
-------
--strict-paths::
@ -155,8 +157,18 @@ upload-pack:: @@ -155,8 +157,18 @@ upload-pack::
disable it by setting `daemon.uploadpack` configuration
item to `false`.

upload-archive::
This serves `git-archive --remote`.

EXAMPLES
--------
We assume the following in /etc/services::
+
------------
$ grep 9418 /etc/services
git 9418/tcp # Git Version Control System
------------

git-daemon as inetd server::
To set up `git-daemon` as an inetd service that handles any
repository under the whitelisted set of directories, /pub/foo
@ -165,8 +177,7 @@ git-daemon as inetd server:: @@ -165,8 +177,7 @@ git-daemon as inetd server::
+
------------------------------------------------
git stream tcp nowait nobody /usr/bin/git-daemon
git-daemon --inetd --verbose
--syslog --export-all
git-daemon --inetd --verbose --export-all
/pub/foo /pub/bar
------------------------------------------------

@ -179,8 +190,7 @@ git-daemon as inetd server for virtual hosts:: @@ -179,8 +190,7 @@ git-daemon as inetd server for virtual hosts::
+
------------------------------------------------
git stream tcp nowait nobody /usr/bin/git-daemon
git-daemon --inetd --verbose
--syslog --export-all
git-daemon --inetd --verbose --export-all
--interpolated-path=/pub/%H%D
/pub/www.example.org/software
/pub/www.example.com/software

10
Documentation/git-for-each-ref.txt

@ -7,14 +7,14 @@ git-for-each-ref - Output information on each ref @@ -7,14 +7,14 @@ git-for-each-ref - Output information on each ref

SYNOPSIS
--------
'git-for-each-ref' [--count=<count>]* [--shell|--perl|--python] [--sort=<key>]* [--format=<format>] [<pattern>]
'git-for-each-ref' [--count=<count>]\* [--shell|--perl|--python] [--sort=<key>]\* [--format=<format>] [<pattern>]

DESCRIPTION
-----------

Iterate over all refs that match `<pattern>` and show them
according to the given `<format>`, after sorting them according
to the given set of `<key>`s. If `<max>` is given, stop after
to the given set of `<key>`. If `<max>` is given, stop after
showing that many refs. The interporated values in `<format>`
can optionally be quoted as string literals in the specified
host language allowing their direct evaluation in that language.
@ -38,7 +38,11 @@ OPTIONS @@ -38,7 +38,11 @@ OPTIONS
is prefixed with an asterisk (`*`) and the ref points
at a tag object, the value for the field in the object
tag refers is used. When unspecified, defaults to
`%(refname)`.
`%(objectname) SPC %(objecttype) TAB %(refname)`.
It also interpolates `%%` to `%`, and `%xx` where `xx`
are hex digits interpolates to character with hex code
`xx`; for example `%00` interpolates to `\0` (NUL),
`%09` to `\t` (TAB) and `%0a` to `\n` (LF).

<pattern>::
If given, the name of the ref is matched against this

24
Documentation/git-index-pack.txt

@ -9,7 +9,7 @@ git-index-pack - Build pack index file for an existing packed archive @@ -9,7 +9,7 @@ git-index-pack - Build pack index file for an existing packed archive
SYNOPSIS
--------
'git-index-pack' [-v] [-o <index-file>] <pack-file>
'git-index-pack' --stdin [--fix-thin] [-v] [-o <index-file>] [<pack-file>]
'git-index-pack' --stdin [--fix-thin] [--keep] [-v] [-o <index-file>] [<pack-file>]


DESCRIPTION
@ -38,7 +38,10 @@ OPTIONS @@ -38,7 +38,10 @@ OPTIONS
instead and a copy is then written to <pack-file>. If
<pack-file> is not specified, the pack is written to
objects/pack/ directory of the current git repository with
a default name determined from the pack content.
a default name determined from the pack content. If
<pack-file> is not specified consider using --keep to
prevent a race condition between this process and
gitlink::git-repack[1] .

--fix-thin::
It is possible for gitlink:git-pack-objects[1] to build
@ -48,7 +51,22 @@ OPTIONS @@ -48,7 +51,22 @@ OPTIONS
and they must be included in the pack for that pack to be self
contained and indexable. Without this option any attempt to
index a thin pack will fail. This option only makes sense in
conjonction with --stdin.
conjunction with --stdin.

--keep::
Before moving the index into its final destination
create an empty .keep file for the associated pack file.
This option is usually necessary with --stdin to prevent a
simultaneous gitlink:git-repack[1] process from deleting
the newly constructed pack and index before refs can be
updated to use objects contained in the pack.

--keep='why'::
Like --keep create a .keep file before moving the index into
its final destination, but rather than creating an empty file
place 'why' followed by an LF into the .keep file. The 'why'
message can later be searched for within all .keep files to
locate any which have outlived their usefulness.


Author

2
Documentation/git-pull.txt

@ -3,7 +3,7 @@ git-pull(1) @@ -3,7 +3,7 @@ git-pull(1)

NAME
----
git-pull - Pull and merge from another repository
git-pull - Pull and merge from another repository or a local branch


SYNOPSIS

25
Documentation/git-rev-parse.txt

@ -122,14 +122,30 @@ blobs contained in a commit. @@ -122,14 +122,30 @@ blobs contained in a commit.
your repository whose object name starts with dae86e.

* An output from `git-describe`; i.e. a closest tag, followed by a
dash, a 'g', and an abbreviated object name.
dash, a `g`, and an abbreviated object name.

* A symbolic ref name. E.g. 'master' typically means the commit
object referenced by $GIT_DIR/refs/heads/master. If you
happen to have both heads/master and tags/master, you can
explicitly say 'heads/master' to tell git which one you mean.
When ambiguous, a `<name>` is disambiguated by taking the
first match in the following rules:

* A suffix '@' followed by a date specification enclosed in a brace
. if `$GIT_DIR/<name>` exists, that is what you mean (this is usually
useful only for `HEAD`, `FETCH_HEAD` and `MERGE_HEAD`);

. otherwise, `$GIT_DIR/refs/<name>` if exists;

. otherwise, `$GIT_DIR/refs/tags/<name>` if exists;

. otherwise, `$GIT_DIR/refs/heads/<name>` if exists;

. otherwise, `$GIT_DIR/refs/remotes/<name>` if exists;

. otherwise, `$GIT_DIR/refs/remotes/<name>/HEAD` if exists.

* A ref followed by the suffix '@' with a date specification
enclosed in a brace
pair (e.g. '\{yesterday\}', '\{1 month 2 weeks 3 days 1 hour 1
second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value
of the ref at a prior point in time. This suffix may only be
@ -146,8 +162,9 @@ blobs contained in a commit. @@ -146,8 +162,9 @@ blobs contained in a commit.
* A suffix '{tilde}<n>' to a revision parameter means the commit
object that is the <n>th generation grand-parent of the named
commit object, following only the first parent. I.e. rev~3 is
equivalent to rev{caret}{caret}{caret} which is equivalent to\
rev{caret}1{caret}1{caret}1.
equivalent to rev{caret}{caret}{caret} which is equivalent to
rev{caret}1{caret}1{caret}1. See below for a illustration of
the usage of this form.

* A suffix '{caret}' followed by an object type name enclosed in
brace pair (e.g. `v0.99.8{caret}\{commit\}`) means the object

9
Documentation/git-send-email.txt

@ -66,8 +66,13 @@ The options available are: @@ -66,8 +66,13 @@ The options available are:
all that is output.

--smtp-server::
If set, specifies the outgoing SMTP server to use. Defaults to
localhost.
If set, specifies the outgoing SMTP server to use. A full
pathname of a sendmail-like program can be specified instead;
the program must support the `-i` option. Default value can
be specified by the 'sendemail.smtpserver' configuration
option; the built-in default is `/usr/sbin/sendmail` or
`/usr/lib/sendmail` if such program is available, or
`localhost` otherwise.

--subject::
Specify the initial subject of the email thread.

363
Documentation/git.txt

@ -72,185 +72,6 @@ GIT COMMANDS @@ -72,185 +72,6 @@ GIT COMMANDS
We divide git into high level ("porcelain") commands and low level
("plumbing") commands.

Low-level commands (plumbing)
-----------------------------

Although git includes its
own porcelain layer, its low-level commands are sufficient to support
development of alternative porcelains. Developers of such porcelains
might start by reading about gitlink:git-update-index[1] and
gitlink:git-read-tree[1].

We divide the low-level commands into commands that manipulate objects (in
the repository, index, and working tree), commands that interrogate and
compare objects, and commands that move objects and references between
repositories.

Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
gitlink:git-apply[1]::
Reads a "diff -up1" or git generated patch file and
applies it to the working tree.

gitlink:git-checkout-index[1]::
Copy files from the index to the working tree.

gitlink:git-commit-tree[1]::
Creates a new commit object.

gitlink:git-hash-object[1]::
Computes the object ID from a file.

gitlink:git-index-pack[1]::
Build pack idx file for an existing packed archive.

gitlink:git-init-db[1]::
Creates an empty git object database, or reinitialize an
existing one.

gitlink:git-merge-index[1]::
Runs a merge for files needing merging.

gitlink:git-mktag[1]::
Creates a tag object.

gitlink:git-mktree[1]::
Build a tree-object from ls-tree formatted text.

gitlink:git-pack-objects[1]::
Creates a packed archive of objects.

gitlink:git-prune-packed[1]::
Remove extra objects that are already in pack files.

gitlink:git-read-tree[1]::
Reads tree information into the index.

gitlink:git-repo-config[1]::
Get and set options in .git/config.

gitlink:git-unpack-objects[1]::
Unpacks objects out of a packed archive.

gitlink:git-update-index[1]::
Registers files in the working tree to the index.

gitlink:git-write-tree[1]::
Creates a tree from the index.


Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~

gitlink:git-cat-file[1]::
Provide content or type/size information for repository objects.

gitlink:git-describe[1]::
Show the most recent tag that is reachable from a commit.

gitlink:git-diff-index[1]::
Compares content and mode of blobs between the index and repository.

gitlink:git-diff-files[1]::
Compares files in the working tree and the index.

gitlink:git-diff-stages[1]::
Compares two "merge stages" in the index.

gitlink:git-diff-tree[1]::
Compares the content and mode of blobs found via two tree objects.

gitlink:git-fsck-objects[1]::
Verifies the connectivity and validity of the objects in the database.

gitlink:git-ls-files[1]::
Information about files in the index and the working tree.

gitlink:git-ls-tree[1]::
Displays a tree object in human readable form.

gitlink:git-merge-base[1]::
Finds as good common ancestors as possible for a merge.

gitlink:git-name-rev[1]::
Find symbolic names for given revs.

gitlink:git-pack-redundant[1]::
Find redundant pack files.

gitlink:git-rev-list[1]::
Lists commit objects in reverse chronological order.

gitlink:git-show-index[1]::
Displays contents of a pack idx file.

gitlink:git-tar-tree[1]::
Creates a tar archive of the files in the named tree object.

gitlink:git-unpack-file[1]::
Creates a temporary file with a blob's contents.

gitlink:git-var[1]::
Displays a git logical variable.

gitlink:git-verify-pack[1]::
Validates packed git archive files.

In general, the interrogate commands do not touch the files in
the working tree.


Synching repositories
~~~~~~~~~~~~~~~~~~~~~

gitlink:git-fetch-pack[1]::
Updates from a remote repository (engine for ssh and
local transport).

gitlink:git-http-fetch[1]::
Downloads a remote git repository via HTTP by walking
commit chain.

gitlink:git-local-fetch[1]::
Duplicates another git repository on a local system by
walking commit chain.

gitlink:git-peek-remote[1]::
Lists references on a remote repository using
upload-pack protocol (engine for ssh and local
transport).

gitlink:git-receive-pack[1]::
Invoked by 'git-send-pack' to receive what is pushed to it.

gitlink:git-send-pack[1]::
Pushes to a remote repository, intelligently.

gitlink:git-http-push[1]::
Push missing objects using HTTP/DAV.

gitlink:git-shell[1]::
Restricted shell for GIT-only SSH access.

gitlink:git-ssh-fetch[1]::
Pulls from a remote repository over ssh connection by
walking commit chain.

gitlink:git-ssh-upload[1]::
Helper "server-side" program used by git-ssh-fetch.

gitlink:git-update-server-info[1]::
Updates auxiliary information on a dumb server to help
clients discover references and packs on it.

gitlink:git-upload-archive[1]::
Invoked by 'git-archive' to send a generated archive.

gitlink:git-upload-pack[1]::
Invoked by 'git-fetch-pack' to push
what are asked for.


High-level commands (porcelain)
-------------------------------

@ -321,7 +142,7 @@ gitlink:git-mv[1]:: @@ -321,7 +142,7 @@ gitlink:git-mv[1]::
Move or rename a file, a directory, or a symlink.

gitlink:git-pull[1]::
Fetch from and merge with a remote repository.
Fetch from and merge with a remote repository or a local branch.

gitlink:git-push[1]::
Update remote refs along with associated objects.
@ -488,6 +309,188 @@ gitlink:git-stripspace[1]:: @@ -488,6 +309,188 @@ gitlink:git-stripspace[1]::
Filter out empty lines.


Low-level commands (plumbing)
-----------------------------

Although git includes its
own porcelain layer, its low-level commands are sufficient to support
development of alternative porcelains. Developers of such porcelains
might start by reading about gitlink:git-update-index[1] and
gitlink:git-read-tree[1].

We divide the low-level commands into commands that manipulate objects (in
the repository, index, and working tree), commands that interrogate and
compare objects, and commands that move objects and references between
repositories.

Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
gitlink:git-apply[1]::
Reads a "diff -up1" or git generated patch file and
applies it to the working tree.

gitlink:git-checkout-index[1]::
Copy files from the index to the working tree.

gitlink:git-commit-tree[1]::
Creates a new commit object.

gitlink:git-hash-object[1]::
Computes the object ID from a file.

gitlink:git-index-pack[1]::
Build pack idx file for an existing packed archive.

gitlink:git-init-db[1]::
Creates an empty git object database, or reinitialize an
existing one.

gitlink:git-merge-index[1]::
Runs a merge for files needing merging.

gitlink:git-mktag[1]::
Creates a tag object.

gitlink:git-mktree[1]::
Build a tree-object from ls-tree formatted text.

gitlink:git-pack-objects[1]::
Creates a packed archive of objects.

gitlink:git-prune-packed[1]::
Remove extra objects that are already in pack files.

gitlink:git-read-tree[1]::
Reads tree information into the index.

gitlink:git-repo-config[1]::
Get and set options in .git/config.

gitlink:git-unpack-objects[1]::
Unpacks objects out of a packed archive.

gitlink:git-update-index[1]::
Registers files in the working tree to the index.

gitlink:git-write-tree[1]::
Creates a tree from the index.


Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~

gitlink:git-cat-file[1]::
Provide content or type/size information for repository objects.

gitlink:git-describe[1]::
Show the most recent tag that is reachable from a commit.

gitlink:git-diff-index[1]::
Compares content and mode of blobs between the index and repository.

gitlink:git-diff-files[1]::
Compares files in the working tree and the index.

gitlink:git-diff-stages[1]::
Compares two "merge stages" in the index.

gitlink:git-diff-tree[1]::
Compares the content and mode of blobs found via two tree objects.

gitlink:git-for-each-ref[1]::
Output information on each ref.

gitlink:git-fsck-objects[1]::
Verifies the connectivity and validity of the objects in the database.

gitlink:git-ls-files[1]::
Information about files in the index and the working tree.

gitlink:git-ls-tree[1]::
Displays a tree object in human readable form.

gitlink:git-merge-base[1]::
Finds as good common ancestors as possible for a merge.

gitlink:git-name-rev[1]::
Find symbolic names for given revs.

gitlink:git-pack-redundant[1]::
Find redundant pack files.

gitlink:git-rev-list[1]::
Lists commit objects in reverse chronological order.

gitlink:git-show-index[1]::
Displays contents of a pack idx file.

gitlink:git-tar-tree[1]::
Creates a tar archive of the files in the named tree object.

gitlink:git-unpack-file[1]::
Creates a temporary file with a blob's contents.

gitlink:git-var[1]::
Displays a git logical variable.

gitlink:git-verify-pack[1]::
Validates packed git archive files.

In general, the interrogate commands do not touch the files in
the working tree.


Synching repositories
~~~~~~~~~~~~~~~~~~~~~

gitlink:git-fetch-pack[1]::
Updates from a remote repository (engine for ssh and
local transport).

gitlink:git-http-fetch[1]::
Downloads a remote git repository via HTTP by walking
commit chain.

gitlink:git-local-fetch[1]::
Duplicates another git repository on a local system by
walking commit chain.

gitlink:git-peek-remote[1]::
Lists references on a remote repository using
upload-pack protocol (engine for ssh and local
transport).

gitlink:git-receive-pack[1]::
Invoked by 'git-send-pack' to receive what is pushed to it.

gitlink:git-send-pack[1]::
Pushes to a remote repository, intelligently.

gitlink:git-http-push[1]::
Push missing objects using HTTP/DAV.

gitlink:git-shell[1]::
Restricted shell for GIT-only SSH access.

gitlink:git-ssh-fetch[1]::
Pulls from a remote repository over ssh connection by
walking commit chain.

gitlink:git-ssh-upload[1]::
Helper "server-side" program used by git-ssh-fetch.

gitlink:git-update-server-info[1]::
Updates auxiliary information on a dumb server to help
clients discover references and packs on it.

gitlink:git-upload-archive[1]::
Invoked by 'git-archive' to send a generated archive.

gitlink:git-upload-pack[1]::
Invoked by 'git-fetch-pack' to push
what are asked for.


Configuration Mechanism
-----------------------


58
combine-diff.c

@ -489,6 +489,16 @@ static void show_parent_lno(struct sline *sline, unsigned long l0, unsigned long @@ -489,6 +489,16 @@ static void show_parent_lno(struct sline *sline, unsigned long l0, unsigned long
printf(" -%lu,%lu", l0, l1-l0);
}

static int hunk_comment_line(const char *bol)
{
int ch;

if (!bol)
return 0;
ch = *bol & 0xff;
return (isalpha(ch) || ch == '_' || ch == '$');
}

static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int use_color)
{
@ -508,8 +518,13 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, @@ -508,8 +518,13 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
struct sline *sl = &sline[lno];
unsigned long hunk_end;
unsigned long rlines;
while (lno <= cnt && !(sline[lno].flag & mark))
const char *hunk_comment = NULL;

while (lno <= cnt && !(sline[lno].flag & mark)) {
if (hunk_comment_line(sline[lno].bol))
hunk_comment = sline[lno].bol;
lno++;
}
if (cnt < lno)
break;
else {
@ -526,6 +541,22 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, @@ -526,6 +541,22 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
show_parent_lno(sline, lno, hunk_end, i);
printf(" +%lu,%lu ", lno+1, rlines);
for (i = 0; i <= num_parent; i++) putchar(combine_marker);

if (hunk_comment) {
int comment_end = 0;
for (i = 0; i < 40; i++) {
int ch = hunk_comment[i] & 0xff;
if (!ch || ch == '\n')
break;
if (!isspace(ch))
comment_end = i;
}
if (comment_end)
putchar(' ');
for (i = 0; i < comment_end; i++)
putchar(hunk_comment[i]);
}

printf("%s\n", c_reset);
while (lno < hunk_end) {
struct lline *ll;
@ -707,8 +738,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, @@ -707,8 +738,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
int use_color = opt->color_diff;
const char *c_meta = diff_get_color(use_color, DIFF_METAINFO);
const char *c_reset = diff_get_color(use_color, DIFF_RESET);
int added = 0;
int deleted = 0;

if (rev->loginfo)
if (rev->loginfo && !rev->no_commit_id)
show_log(rev, opt->msg_sep);
dump_quoted_path(dense ? "diff --cc " : "diff --combined ",
elem->path, c_meta, c_reset);
@ -722,7 +755,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, @@ -722,7 +755,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
printf("..%s%s\n", abb, c_reset);

if (mode_differs) {
int added = !!elem->mode;
deleted = !elem->mode;

/* We say it was added if nobody had it */
added = !deleted;
for (i = 0; added && i < num_parent; i++)
if (elem->parent[i].status !=
DIFF_STATUS_ADDED)
@ -731,7 +767,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, @@ -731,7 +767,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
printf("%snew file mode %06o",
c_meta, elem->mode);
else {
if (!elem->mode)
if (deleted)
printf("%sdeleted file ", c_meta);
printf("mode ");
for (i = 0; i < num_parent; i++) {
@ -743,8 +779,14 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, @@ -743,8 +779,14 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
}
printf("%s\n", c_reset);
}
dump_quoted_path("--- a/", elem->path, c_meta, c_reset);
dump_quoted_path("+++ b/", elem->path, c_meta, c_reset);
if (added)
dump_quoted_path("--- /dev/", "null", c_meta, c_reset);
else
dump_quoted_path("--- a/", elem->path, c_meta, c_reset);
if (deleted)
dump_quoted_path("+++ /dev/", "null", c_meta, c_reset);
else
dump_quoted_path("+++ b/", elem->path, c_meta, c_reset);
dump_sline(sline, cnt, num_parent, opt->color_diff);
}
free(result);
@ -777,7 +819,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re @@ -777,7 +819,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
if (!line_termination)
inter_name_termination = 0;

if (rev->loginfo)
if (rev->loginfo && !rev->no_commit_id)
show_log(rev, opt->msg_sep);

if (opt->output_format & DIFF_FORMAT_RAW) {
@ -849,7 +891,7 @@ void diff_tree_combined(const unsigned char *sha1, @@ -849,7 +891,7 @@ void diff_tree_combined(const unsigned char *sha1,
diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
diffopts.recursive = 1;

show_log_first = !!rev->loginfo;
show_log_first = !!rev->loginfo && !rev->no_commit_id;
needsep = 0;
/* find set of paths that everybody touches */
for (i = 0; i < num_parent; i++) {

29
contrib/completion/git-completion.bash

@ -101,6 +101,23 @@ __git_complete_file () @@ -101,6 +101,23 @@ __git_complete_file ()
esac
}

__git_aliases ()
{
git repo-config --list | grep '^alias\.' \
| sed -e 's/^alias\.//' -e 's/=.*$//'
}

__git_aliased_command ()
{
local cmdline=$(git repo-config alias.$1)
for word in $cmdline; do
if [ "${word##-*}" ]; then
echo $word
return
fi
done
}

_git_branch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@ -264,10 +281,18 @@ _git () @@ -264,10 +281,18 @@ _git ()
{
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=($(compgen \
-W "--version $(git help -a|egrep '^ ')" \
-W "--version $(git help -a|egrep '^ ') \
$(__git_aliases)" \
-- "${COMP_WORDS[COMP_CWORD]}"))
else
case "${COMP_WORDS[1]}" in
local command="${COMP_WORDS[1]}"
local expansion=$(__git_aliased_command "$command")

if [ "$expansion" ]; then
command="$expansion"
fi

case "$command" in
branch) _git_branch ;;
cat-file) _git_cat_file ;;
checkout) _git_checkout ;;

27
git-repack.sh

@ -45,11 +45,19 @@ case ",$all_into_one," in @@ -45,11 +45,19 @@ case ",$all_into_one," in
args='--unpacked --incremental'
;;
,t,)
args=

# Redundancy check in all-into-one case is trivial.
existing=`test -d "$PACKDIR" && cd "$PACKDIR" && \
find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
if [ -d "$PACKDIR" ]; then
for e in `cd "$PACKDIR" && find . -type f -name '*.pack' \
| sed -e 's/^\.\///' -e 's/\.pack$//'`
do
if [ -e "$PACKDIR/$e.keep" ]; then
: keep
else
args="$args --unpacked=$e.pack"
existing="$existing $e"
fi
done
fi
[ -z "$args" ] && args='--unpacked --incremental'
;;
esac

@ -86,17 +94,16 @@ fi @@ -86,17 +94,16 @@ fi

if test "$remove_redundant" = t
then
# We know $existing are all redundant only when
# all-into-one is used.
if test "$all_into_one" != '' && test "$existing" != ''
# We know $existing are all redundant.
if [ -n "$existing" ]
then
sync
( cd "$PACKDIR" &&
for e in $existing
do
case "$e" in
./pack-$name.pack | ./pack-$name.idx) ;;
*) rm -f $e ;;
pack-$name) ;;
*) rm -f "$e.pack" "$e.idx" "$e.keep" ;;
esac
done
)

3
git-send-email.perl

@ -230,6 +230,9 @@ if (!defined $initial_reply_to && $prompting) { @@ -230,6 +230,9 @@ if (!defined $initial_reply_to && $prompting) {
$initial_reply_to =~ s/(^\s+|\s+$)//g;
}

if (!$smtp_server) {
$smtp_server = $repo->config('sendemail.smtpserver');
}
if (!$smtp_server) {
foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
if (-x $_) {

106
gitweb/gitweb.perl

@ -51,12 +51,8 @@ our $site_footer = "++GITWEB_SITE_FOOTER++"; @@ -51,12 +51,8 @@ our $site_footer = "++GITWEB_SITE_FOOTER++";

# URI of stylesheets
our @stylesheets = ("++GITWEB_CSS++");
our $stylesheet;
# default is not to define style sheet, but it can be overwritten later
undef $stylesheet;

# URI of default stylesheet
our $stylesheet = "++GITWEB_CSS++";
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
our $logo = "++GITWEB_LOGO++";
# URI of GIT favicon, assumed to be image/png type
@ -80,7 +76,7 @@ our $strict_export = "++GITWEB_STRICT_EXPORT++"; @@ -80,7 +76,7 @@ our $strict_export = "++GITWEB_STRICT_EXPORT++";

# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
our @git_base_url_list = ("++GITWEB_BASE_URL++");
our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");

# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@ -980,6 +976,24 @@ sub git_get_project_owner { @@ -980,6 +976,24 @@ sub git_get_project_owner {
return $owner;
}

sub git_get_last_activity {
my ($path) = @_;
my $fd;

$git_dir = "$projectroot/$path";
open($fd, "-|", git_cmd(), 'for-each-ref',
'--format=%(refname) %(committer)',
'--sort=-committerdate',
'refs/heads') or return;
my $most_recent = <$fd>;
close $fd or return;
if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
my $timestamp = $1;
my $age = time - $timestamp;
return ($age, age_string($age));
}
}

sub git_get_references {
my $type = shift || "";
my %refs;
@ -1086,24 +1100,6 @@ sub parse_tag { @@ -1086,24 +1100,6 @@ sub parse_tag {
return %tag
}

sub git_get_last_activity {
my ($path) = @_;
my $fd;

$git_dir = "$projectroot/$path";
open($fd, "-|", git_cmd(), 'for-each-ref',
'--format=%(refname) %(committer)',
'--sort=-committerdate',
'refs/heads') or return;
my $most_recent = <$fd>;
close $fd or return;
if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
my $timestamp = $1;
my $age = time - $timestamp;
return ($age, age_string($age));
}
}

sub parse_commit {
my $commit_id = shift;
my $commit_text = shift;
@ -3133,14 +3129,12 @@ sub git_commit { @@ -3133,14 +3129,12 @@ sub git_commit {
if (!defined $parent) {
$parent = "--root";
}
open my $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts, $parent, $hash
open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
@diff_opts, $parent, $hash
or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-diff-tree failed");

# filter out commit ID output
@difftree = grep(!/^[0-9a-fA-F]{40}$/, @difftree);

# non-textual hash id's can be cached
my $expires;
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
@ -3402,6 +3396,51 @@ sub git_commitdiff { @@ -3402,6 +3396,51 @@ sub git_commitdiff {
if (!%co) {
die_error(undef, "Unknown commit object");
}

# we need to prepare $formats_nav before any parameter munging
my $formats_nav;
if ($format eq 'html') {
$formats_nav =
$cgi->a({-href => href(action=>"commitdiff_plain",
hash=>$hash, hash_parent=>$hash_parent)},
"raw");

if (defined $hash_parent) {
# commitdiff with two commits given
my $hash_parent_short = $hash_parent;
if ($hash_parent =~ m/^[0-9a-fA-F]{40}$/) {
$hash_parent_short = substr($hash_parent, 0, 7);
}
$formats_nav .=
' (from: ' .
$cgi->a({-href => href(action=>"commitdiff",
hash=>$hash_parent)},
esc_html($hash_parent_short)) .
')';
} elsif (!$co{'parent'}) {
# --root commitdiff
$formats_nav .= ' (initial)';
} elsif (scalar @{$co{'parents'}} == 1) {
# single parent commit
$formats_nav .=
' (parent: ' .
$cgi->a({-href => href(action=>"commitdiff",
hash=>$co{'parent'})},
esc_html(substr($co{'parent'}, 0, 7))) .
')';
} else {
# merge commit
$formats_nav .=
' (merge: ' .
join(' ', map {
$cgi->a({-href => href(action=>"commitdiff",
hash=>$_)},
esc_html(substr($_, 0, 7)));
} @{$co{'parents'}} ) .
')';
}
}

if (!defined $hash_parent) {
$hash_parent = $co{'parent'} || '--root';
}
@ -3411,15 +3450,14 @@ sub git_commitdiff { @@ -3411,15 +3450,14 @@ sub git_commitdiff {
my @difftree;
if ($format eq 'html') {
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
"--no-commit-id",
"--patch-with-raw", "--full-index", $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed");

while (chomp(my $line = <$fd>)) {
# empty line ends raw part of diff-tree output
last unless $line;
# filter out commit ID output
push @difftree, $line
unless $line =~ m/^[0-9a-fA-F]{40}$/;
push @difftree, $line;
}

} elsif ($format eq 'plain') {
@ -3441,10 +3479,6 @@ sub git_commitdiff { @@ -3441,10 +3479,6 @@ sub git_commitdiff {
if ($format eq 'html') {
my $refs = git_get_references();
my $ref = format_ref_marker($refs, $co{'id'});
my $formats_nav =
$cgi->a({-href => href(action=>"commitdiff_plain",
hash=>$hash, hash_parent=>$hash_parent)},
"raw");

git_header_html(undef, $expires);
git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);

43
index-pack.c

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <signal.h>

static const char index_pack_usage[] =
"git-index-pack [-v] [-o <index-file>] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
"git-index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";

struct object_entry
{
@ -754,6 +754,7 @@ static const char *write_index_file(const char *index_name, unsigned char *sha1) @@ -754,6 +754,7 @@ static const char *write_index_file(const char *index_name, unsigned char *sha1)

static void final(const char *final_pack_name, const char *curr_pack_name,
const char *final_index_name, const char *curr_index_name,
const char *keep_name, const char *keep_msg,
unsigned char *sha1)
{
char name[PATH_MAX];
@ -780,6 +781,23 @@ static void final(const char *final_pack_name, const char *curr_pack_name, @@ -780,6 +781,23 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
}
}

if (keep_msg) {
int keep_fd, keep_msg_len = strlen(keep_msg);
if (!keep_name) {
snprintf(name, sizeof(name), "%s/pack/pack-%s.keep",
get_object_directory(), sha1_to_hex(sha1));
keep_name = name;
}
keep_fd = open(keep_name, O_RDWR | O_CREAT, 0600);
if (keep_fd < 0)
die("cannot write keep file");
if (keep_msg_len > 0) {
write_or_die(keep_fd, keep_msg, keep_msg_len);
write_or_die(keep_fd, "\n", 1);
}
close(keep_fd);
}

if (final_pack_name != curr_pack_name) {
if (!final_pack_name) {
snprintf(name, sizeof(name), "%s/pack/pack-%s.pack",
@ -807,7 +825,8 @@ int main(int argc, char **argv) @@ -807,7 +825,8 @@ int main(int argc, char **argv)
int i, fix_thin_pack = 0;
const char *curr_pack, *pack_name = NULL;
const char *curr_index, *index_name = NULL;
char *index_name_buf = NULL;
const char *keep_name = NULL, *keep_msg = NULL;
char *index_name_buf = NULL, *keep_name_buf = NULL;
unsigned char sha1[20];

for (i = 1; i < argc; i++) {
@ -818,6 +837,10 @@ int main(int argc, char **argv) @@ -818,6 +837,10 @@ int main(int argc, char **argv)
from_stdin = 1;
} else if (!strcmp(arg, "--fix-thin")) {
fix_thin_pack = 1;
} else if (!strcmp(arg, "--keep")) {
keep_msg = "";
} else if (!strncmp(arg, "--keep=", 7)) {
keep_msg = arg + 7;
} else if (!strcmp(arg, "-v")) {
verbose = 1;
} else if (!strcmp(arg, "-o")) {
@ -848,6 +871,16 @@ int main(int argc, char **argv) @@ -848,6 +871,16 @@ int main(int argc, char **argv)
strcpy(index_name_buf + len - 5, ".idx");
index_name = index_name_buf;
}
if (keep_msg && !keep_name && pack_name) {
int len = strlen(pack_name);
if (!has_extension(pack_name, ".pack"))
die("packfile name '%s' does not end with '.pack'",
pack_name);
keep_name_buf = xmalloc(len);
memcpy(keep_name_buf, pack_name, len - 5);
strcpy(keep_name_buf + len - 5, ".keep");
keep_name = keep_name_buf;
}

curr_pack = open_pack_file(pack_name);
parse_pack_header();
@ -880,9 +913,13 @@ int main(int argc, char **argv) @@ -880,9 +913,13 @@ int main(int argc, char **argv)
}
free(deltas);
curr_index = write_index_file(index_name, sha1);
final(pack_name, curr_pack, index_name, curr_index, sha1);
final(pack_name, curr_pack,
index_name, curr_index,
keep_name, keep_msg,
sha1);
free(objects);
free(index_name_buf);
free(keep_name_buf);

if (!from_stdin)
printf("%s\n", sha1_to_hex(sha1));

7
receive-pack.c

@ -273,11 +273,10 @@ static void read_head_info(void) @@ -273,11 +273,10 @@ static void read_head_info(void)
}
}

static const char *unpack(int *error_code)
static const char *unpack(void)
{
int code = run_command_v_opt(1, unpacker, RUN_GIT_CMD);

*error_code = 0;
switch (code) {
case 0:
return NULL;
@ -294,7 +293,6 @@ static const char *unpack(int *error_code) @@ -294,7 +293,6 @@ static const char *unpack(int *error_code)
case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
return "unpacker died strangely";
default:
*error_code = -code;
return "unpacker exited with error code";
}
}
@ -345,8 +343,7 @@ int main(int argc, char **argv) @@ -345,8 +343,7 @@ int main(int argc, char **argv)

read_head_info();
if (commands) {
int code;
const char *unpack_status = unpack(&code);
const char *unpack_status = unpack();
if (!unpack_status)
execute_commands();
if (report_status)

20
sha1_file.c

@ -1203,6 +1203,24 @@ unsigned long find_pack_entry_one(const unsigned char *sha1, @@ -1203,6 +1203,24 @@ unsigned long find_pack_entry_one(const unsigned char *sha1,
return 0;
}

static int matches_pack_name(struct packed_git *p, const char *ig)
{
const char *last_c, *c;

if (!strcmp(p->pack_name, ig))
return 0;

for (c = p->pack_name, last_c = c; *c;)
if (*c == '/')
last_c = ++c;
else
++c;
if (!strcmp(last_c, ig))
return 0;

return 1;
}

static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, const char **ignore_packed)
{
struct packed_git *p;
@ -1214,7 +1232,7 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons @@ -1214,7 +1232,7 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons
if (ignore_packed) {
const char **ig;
for (ig = ignore_packed; *ig; ig++)
if (!strcmp(p->pack_name, *ig))
if (!matches_pack_name(p, *ig))
break;
if (*ig)
continue;

5
t/t3401-rebase-partial.sh

@ -52,13 +52,10 @@ test_expect_success \ @@ -52,13 +52,10 @@ test_expect_success \
'rebase topic branch against new master and check git-am did not get halted' \
'git-rebase master && test ! -d .dotest'

if test -z "$no_python"
then
test_expect_success \
test_expect_success \
'rebase --merge topic branch that was partially merged upstream' \
'git-checkout -f my-topic-branch-merge &&
git-rebase --merge master-merge &&
test ! -d .git/.dotest-merge'
fi

test_done

6
t/t3402-rebase-merge.sh

@ -7,12 +7,6 @@ test_description='git rebase --merge test' @@ -7,12 +7,6 @@ test_description='git rebase --merge test'

. ./test-lib.sh

if test "$no_python"; then
echo "Skipping: no python => no recursive merge"
test_done
exit 0
fi

T="A quick brown fox
jumps over the lazy dog."
for i in 1 2 3 4 5 6 7 8 9 10

6
t/t3403-rebase-skip.sh

@ -10,12 +10,6 @@ test_description='git rebase --merge --skip tests' @@ -10,12 +10,6 @@ test_description='git rebase --merge --skip tests'
# we assume the default git-am -3 --skip strategy is tested independently
# and always works :)

if test "$no_python"; then
echo "Skipping: no python => no recursive merge"
test_done
exit 0
fi

test_expect_success setup '
echo hello > hello &&
git add hello &&

6
t/t6021-merge-criss-cross.sh

@ -10,12 +10,6 @@ @@ -10,12 +10,6 @@
test_description='Test criss-cross merge'
. ./test-lib.sh

if test "$no_python"; then
echo "Skipping: no python => no recursive merge"
test_done
exit 0
fi

test_expect_success 'prepare repository' \
'echo "1
2

6
t/t6022-merge-rename.sh

@ -3,12 +3,6 @@ @@ -3,12 +3,6 @@
test_description='Merge-recursive merging renames'
. ./test-lib.sh

if test "$no_python"; then
echo "Skipping: no python => no recursive merge"
test_done
exit 0
fi

test_expect_success setup \
'
cat >A <<\EOF &&

14
wt-status.c

@ -72,25 +72,25 @@ static void wt_status_print_filepair(int t, struct diff_filepair *p) @@ -72,25 +72,25 @@ static void wt_status_print_filepair(int t, struct diff_filepair *p)
color_printf(color(WT_STATUS_HEADER), "#\t");
switch (p->status) {
case DIFF_STATUS_ADDED:
color_printf(c, "new file: %s", p->one->path); break;
color_printf(c, "new file: %s", p->one->path); break;
case DIFF_STATUS_COPIED:
color_printf(c, "copied: %s -> %s",
color_printf(c, "copied: %s -> %s",
p->one->path, p->two->path);
break;
case DIFF_STATUS_DELETED:
color_printf(c, "deleted: %s", p->one->path); break;
color_printf(c, "deleted: %s", p->one->path); break;
case DIFF_STATUS_MODIFIED:
color_printf(c, "modified: %s", p->one->path); break;
color_printf(c, "modified: %s", p->one->path); break;
case DIFF_STATUS_RENAMED:
color_printf(c, "renamed: %s -> %s",
color_printf(c, "renamed: %s -> %s",
p->one->path, p->two->path);
break;
case DIFF_STATUS_TYPE_CHANGED:
color_printf(c, "typechange: %s", p->one->path); break;
case DIFF_STATUS_UNKNOWN:
color_printf(c, "unknown: %s", p->one->path); break;
color_printf(c, "unknown: %s", p->one->path); break;
case DIFF_STATUS_UNMERGED:
color_printf(c, "unmerged: %s", p->one->path); break;
color_printf(c, "unmerged: %s", p->one->path); break;
default:
die("bug: unhandled diff status %c", p->status);
}

Loading…
Cancel
Save