summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/Makefile6
-rw-r--r--Documentation/config.txt11
-rw-r--r--Documentation/git-svn.txt8
-rw-r--r--Documentation/git.txt13
-rw-r--r--Documentation/gitcore-tutorial.txt (renamed from Documentation/core-tutorial.txt)26
-rw-r--r--Documentation/gitcvs-migration.txt7
-rw-r--r--Documentation/gitglossary.txt25
-rw-r--r--Documentation/gittutorial-2.txt8
-rw-r--r--Documentation/gittutorial.txt2
-rw-r--r--Documentation/glossary-content.txt (renamed from Documentation/glossary.txt)17
-rw-r--r--Documentation/pull-fetch-param.txt4
-rw-r--r--Documentation/technical/api-revision-walking.txt60
-rw-r--r--Documentation/urls-remotes.txt93
-rw-r--r--Documentation/user-manual.txt5
-rwxr-xr-xgit-svn.perl11
-rw-r--r--gitweb/test/Märchen2
-rw-r--r--gitweb/test/file with spaces4
-rw-r--r--gitweb/test/file+plus+sign6
-rw-r--r--graph.c123
-rw-r--r--http-push.c1
-rw-r--r--lockfile.c3
-rw-r--r--perl/Git.pm7
-rw-r--r--read-cache.c9
-rwxr-xr-xt/t7502-commit.sh14
24 files changed, 356 insertions, 109 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9750334b97..ca4dadf940 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -4,7 +4,7 @@ MAN1_TXT= \
gitk.txt
MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt
MAN7_TXT=git.txt gitcli.txt gittutorial.txt gittutorial-2.txt \
- gitcvs-migration.txt
+ gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt
MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
@@ -12,13 +12,11 @@ MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
DOC_HTML=$(MAN_HTML)
-ARTICLES = core-tutorial
-ARTICLES += diffcore
+ARTICLES = diffcore
ARTICLES += howto-index
ARTICLES += repository-layout
ARTICLES += everyday
ARTICLES += git-tools
-ARTICLES += glossary
# with their own formatting rules.
SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
diff --git a/Documentation/config.txt b/Documentation/config.txt
index c298dc21c5..5331b450ea 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -205,10 +205,13 @@ Can be overridden by the 'GIT_PROXY_COMMAND' environment variable
handling).
core.ignoreStat::
- The working copy files are assumed to stay unchanged until you
- mark them otherwise manually - Git will not detect the file changes
- by lstat() calls. This is useful on systems where those are very
- slow, such as Microsoft Windows. See linkgit:git-update-index[1].
+ If true, commands which modify both the working tree and the index
+ will mark the updated paths with the "assume unchanged" bit in the
+ index. These marked files are then assumed to stay unchanged in the
+ working copy, until you mark them otherwise manually - Git will not
+ detect the file changes by lstat() calls. This is useful on systems
+ where those are very slow, such as Microsoft Windows.
+ See linkgit:git-update-index[1].
False by default.
core.preferSymlinkRefs::
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index c9e4efe7f4..f4cbd2f212 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -365,11 +365,15 @@ Passed directly to git-rebase when using 'dcommit' if a
-n::
--dry-run::
-This is only used with the 'dcommit' command.
+This can be used with the 'dcommit' and 'rebase' commands.
-Print out the series of git arguments that would show
+For 'dcommit', print out the series of git arguments that would show
which diffs would be committed to SVN.
+For 'rebase', display the local branch associated with the upstream svn
+repository associated with the current branch and the URL of svn
+repository that will be fetched from.
+
--
ADVANCED OPTIONS
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 7182bb7f7e..dae1b4031c 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -174,7 +174,7 @@ See the references above to get started using git. The following is
probably more detail than necessary for a first-time user.
The link:user-manual.html#git-concepts[git concepts chapter of the
-user-manual] and the link:core-tutorial.html[Core tutorial] both provide
+user-manual] and the linkgit:gitcore-tutorial[7][Core tutorial] both provide
introductions to the underlying git architecture.
See also the link:howto-index.html[howto] documents for some useful
@@ -374,7 +374,7 @@ Higher level SCMs may provide and manage additional information in the
Terminology
-----------
-Please see the link:glossary.html[glossary] document.
+Please see the linkgit:gitglossary[7][glossary] document.
Environment Variables
@@ -518,7 +518,7 @@ Discussion[[Discussion]]
More detail on the following is available from the
link:user-manual.html#git-concepts[git concepts chapter of the
-user-manual] and the link:core-tutorial.html[Core tutorial].
+user-manual] and the linkgit:gitcore-tutorial[7][Core tutorial].
A git project normally consists of a working directory with a ".git"
subdirectory at the top level. The .git directory contains, among other
@@ -579,6 +579,13 @@ The documentation for git suite was started by David Greaves
<david@dgreaves.com>, and later enhanced greatly by the
contributors on the git-list <git@vger.kernel.org>.
+SEE ALSO
+--------
+linkgit:gittutorial[7], linkgit:gittutorial-2[7],
+linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
+linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
+link:user-manual.html[The Git User's Manual]
+
GIT
---
Part of the linkgit:git[7] suite
diff --git a/Documentation/core-tutorial.txt b/Documentation/gitcore-tutorial.txt
index b50b5dd487..5995a2e152 100644
--- a/Documentation/core-tutorial.txt
+++ b/Documentation/gitcore-tutorial.txt
@@ -1,8 +1,16 @@
-A git core tutorial for developers
-==================================
+gitcore-tutorial(7)
+===================
-Introduction
-------------
+NAME
+----
+gitcore-tutorial - A git core tutorial for developers
+
+SYNOPSIS
+--------
+git *
+
+DESCRIPTION
+-----------
This tutorial explains how to use the "core" git programs to set up and
work with a git repository.
@@ -1679,3 +1687,13 @@ merge two at a time, documenting how you resolved the conflicts,
and the reason why you preferred changes made in one side over
the other. Otherwise it would make the project history harder
to follow, not easier.
+
+SEE ALSO
+--------
+linkgit:gittutorial[7], linkgit:gittutorial-2[7],
+linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
+link:user-manual.html[The Git User's Manual]
+
+GIT
+---
+Part of the linkgit:git[7] suite.
diff --git a/Documentation/gitcvs-migration.txt b/Documentation/gitcvs-migration.txt
index c410805027..de02a4268e 100644
--- a/Documentation/gitcvs-migration.txt
+++ b/Documentation/gitcvs-migration.txt
@@ -20,7 +20,7 @@ this document explains how to do that.
Some basic familiarity with git is required. This
linkgit:gittutorial[7][tutorial introduction to git] and the
-link:glossary.html[git glossary] should be sufficient.
+linkgit:gitglossary[7][git glossary] should be sufficient.
Developing against a shared repository
--------------------------------------
@@ -184,7 +184,10 @@ repositories without the need for a central maintainer.
SEE ALSO
--------
-linkgit:gittutorial[7], linkgit:gittutorial-2[7],
+linkgit:gittutorial[7],
+linkgit:gittutorial-2[7],
+linkgit:gitcore-tutorial[7],
+linkgit:gitglossary[7],
link:everyday.html[Everyday Git],
link:user-manual.html[The Git User's Manual]
diff --git a/Documentation/gitglossary.txt b/Documentation/gitglossary.txt
new file mode 100644
index 0000000000..e8475a042c
--- /dev/null
+++ b/Documentation/gitglossary.txt
@@ -0,0 +1,25 @@
+gitglossary(7)
+==============
+
+NAME
+----
+gitglossary - A GIT Glossary
+
+SYNOPSIS
+--------
+*
+
+DESCRIPTION
+-----------
+
+include::glossary-content.txt[]
+
+SEE ALSO
+--------
+linkgit:gittutorial[7], linkgit:gittutorial-2[7],
+linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
+link:user-manual.html[The Git User's Manual]
+
+GIT
+---
+Part of the linkgit:git[7] suite.
diff --git a/Documentation/gittutorial-2.txt b/Documentation/gittutorial-2.txt
index 5bbbf43056..4880ba9ae9 100644
--- a/Documentation/gittutorial-2.txt
+++ b/Documentation/gittutorial-2.txt
@@ -390,7 +390,7 @@ in the index file is identical to the one in the working directory.
In addition to being the staging area for new commits, the index file
is also populated from the object database when checking out a
branch, and is used to hold the trees involved in a merge operation.
-See the link:core-tutorial.html[core tutorial] and the relevant man
+See the linkgit:gitcore-tutorial[7][core tutorial] and the relevant man
pages for details.
What next?
@@ -400,7 +400,7 @@ At this point you should know everything necessary to read the man
pages for any of the git commands; one good place to start would be
with the commands mentioned in link:everyday.html[Everyday git]. You
should be able to find any unknown jargon in the
-link:glossary.html[Glossary].
+linkgit:gitglossary[7][Glossary].
The link:user-manual.html[Git User's Manual] provides a more
comprehensive introduction to git.
@@ -412,7 +412,7 @@ CVS-like way.
For some interesting examples of git use, see the
link:howto-index.html[howtos].
-For git developers, the link:core-tutorial.html[Core tutorial] goes
+For git developers, the linkgit:gitcore-tutorial[7][Core tutorial] goes
into detail on the lower-level git mechanisms involved in, for
example, creating a new commit.
@@ -420,6 +420,8 @@ SEE ALSO
--------
linkgit:gittutorial[7],
linkgit:gitcvs-migration[7],
+linkgit:gitcore-tutorial[7],
+linkgit:gitglossary[7],
link:everyday.html[Everyday git],
link:user-manual.html[The Git User's Manual]
diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt
index 898acdb533..722b323214 100644
--- a/Documentation/gittutorial.txt
+++ b/Documentation/gittutorial.txt
@@ -598,6 +598,8 @@ SEE ALSO
--------
linkgit:gittutorial-2[7],
linkgit:gitcvs-migration[7],
+linkgit:gitcore-tutorial[7],
+linkgit:gitglossary[7],
link:everyday.html[Everyday git],
link:user-manual.html[The Git User's Manual]
diff --git a/Documentation/glossary.txt b/Documentation/glossary-content.txt
index 51b63532b6..9b4a4f45e9 100644
--- a/Documentation/glossary.txt
+++ b/Documentation/glossary-content.txt
@@ -1,6 +1,3 @@
-GIT Glossary
-============
-
[[def_alternate_object_database]]alternate object database::
Via the alternates mechanism, a <<def_repository,repository>>
can inherit part of its <<def_object_database,object database>>
@@ -90,11 +87,10 @@ to point at the new commit.
source code management tools.
[[def_DAG]]DAG::
- Directed acyclic graph. The <<def_commit,commit>> objects form a
+ Directed acyclic graph. The <<def_commit_object,commit objects>> form a
directed acyclic graph, because they have parents (directed), and the
- graph of commit objects is acyclic (there is no
- <<def_chain,chain>> which begins and ends with the same
- <<def_object,object>>).
+ graph of commit objects is acyclic (there is no <<def_chain,chain>>
+ which begins and ends with the same <<def_object,object>>).
[[def_dangling_object]]dangling object::
An <<def_unreachable_object,unreachable object>> which is not
@@ -250,9 +246,10 @@ This commit is referred to as a "merge commit", or sometimes just a
the <<def_hash,hash>> of the object.
[[def_object_type]]object type::
- One of the identifiers
- "<<def_commit,commit>>","<<def_tree,tree>>","<<def_tag,tag>>" or "<<def_blob_object,blob>>"
- describing the type of an <<def_object,object>>.
+ One of the identifiers "<<def_commit_object,commit>>",
+ "<<def_tree_object,tree>>", "<<def_tag_object,tag>>" or
+ "<<def_blob_object,blob>>" describing the type of an
+ <<def_object,object>>.
[[def_octopus]]octopus::
To <<def_merge,merge>> more than two <<def_branch,branches>>. Also denotes an
diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt
index b6eb7fc618..cbee369947 100644
--- a/Documentation/pull-fetch-param.txt
+++ b/Documentation/pull-fetch-param.txt
@@ -1,6 +1,8 @@
<repository>::
The "remote" repository that is the source of a fetch
- or pull operation. See the section <<URLS,GIT URLS>> below.
+ or pull operation. This parameter can be either a URL
+ (see the section <<URLS,GIT URLS>> below) or the name
+ of a remote (see the section <<REMOTES,REMOTES>> below).
<refspec>::
The canonical format of a <refspec> parameter is
diff --git a/Documentation/technical/api-revision-walking.txt b/Documentation/technical/api-revision-walking.txt
index 01a24551af..996da0503a 100644
--- a/Documentation/technical/api-revision-walking.txt
+++ b/Documentation/technical/api-revision-walking.txt
@@ -1,9 +1,67 @@
revision walking API
====================
+The revision walking API offers functions to build a list of revisions
+and then iterate over that list.
+
+Calling sequence
+----------------
+
+The walking API has a given calling sequence: first you need to
+initialize a rev_info structure, then add revisions to control what kind
+of revision list do you want to get, finally you can iterate over the
+revision list.
+
+Functions
+---------
+
+`init_revisions`::
+
+ Initialize a rev_info structure with default values. The second
+ parameter may be NULL or can be prefix path, and then the `.prefix`
+ variable will be set to it. This is typically the first function you
+ want to call when you want to deal with a revision list. After calling
+ this function, you are free to customize options, like set
+ `.ignore_merges` to 0 if you don't want to ignore merges, and so on. See
+ `revision.h` for a complete list of available options.
+
+`add_pending_object`::
+
+ This function can be used if you want to add commit objects as revision
+ information. You can use the `UNINTERESTING` object flag to indicate if
+ you want to include or exclude the given commit (and commits reachable
+ from the given commit) from the revision list.
++
+NOTE: If you have the commits as a string list then you probably want to
+use setup_revisions(), instead of parsing each string and using this
+function.
+
+`setup_revisions`::
+
+ Parse revision information, filling in the `rev_info` structure, and
+ removing the used arguments from the argument list. Returns the number
+ of arguments left that weren't recognized, which are also moved to the
+ head of the argument list. The last parameter is used in case no
+ parameter given by the first two arguments.
+
+`prepare_revision_walk`::
+
+ Prepares the rev_info structure for a walk. You should check if it
+ returns any error (non-zero return code) and if it does not, you can
+ start using get_revision() to do the iteration.
+
+`get_revision`::
+
+ Takes a pointer to a `rev_info` structure and iterates over it,
+ returning a `struct commit *` each time you call it. The end of the
+ revision list is indicated by returning a NULL pointer.
+
+Data structures
+---------------
+
Talk about <revision.h>, things like:
* two diff_options, one for path limiting, another for output;
-* calling sequence: init_revisions(), setup_revsions(), get_revision();
+* remaining functions;
(Linus, JC, Dscho)
diff --git a/Documentation/urls-remotes.txt b/Documentation/urls-remotes.txt
index 5dd1f836c6..99753006e2 100644
--- a/Documentation/urls-remotes.txt
+++ b/Documentation/urls-remotes.txt
@@ -1,55 +1,82 @@
include::urls.txt[]
-REMOTES
--------
+REMOTES[[REMOTES]]
+------------------
-In addition to the above, as a short-hand, the name of a
-file in `$GIT_DIR/remotes` directory can be given; the
-named file should be in the following format:
+The name of one of the following can be used instead
+of a URL as `<repository>` argument:
-------------
- URL: one of the above URL format
- Push: <refspec>
- Pull: <refspec>
+* a remote in the git configuration file: `$GIT_DIR/config`,
+* a file in the `$GIT_DIR/remotes` directory, or
+* a file in the `$GIT_DIR/branches` directory.
-------------
+All of these also allow you to omit the refspec from the command line
+because they each contain a refspec which git will use by default.
-Then such a short-hand is specified in place of
-<repository> without <refspec> parameters on the command
-line, <refspec> specified on `Push:` lines or `Pull:`
-lines are used for `git-push` and `git-fetch`/`git-pull`,
-respectively. Multiple `Push:` and `Pull:` lines may
-be specified for additional branch mappings.
+Named remote in configuration file
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Or, equivalently, in the `$GIT_DIR/config` (note the use
-of `fetch` instead of `Pull:`):
+You can choose to provide the name of a remote which you had previously
+configured using linkgit:git-remote[1], linkgit:git-config[1]
+or even by a manual edit to the `$GIT_DIR/config` file. The URL of
+this remote will be used to access the repository. The refspec
+of this remote will be used by default when you do
+not provide a refspec on the command line. The entry in the
+config file would appear like this:
------------
- [remote "<remote>"]
+ [remote "<name>"]
url = <url>
push = <refspec>
fetch = <refspec>
-
------------
-The name of a file in `$GIT_DIR/branches` directory can be
-specified as an older notation short-hand; the named
-file should contain a single line, a URL in one of the
-above formats, optionally followed by a hash `#` and the
-name of remote head (URL fragment notation).
-`$GIT_DIR/branches/<remote>` file that stores a <url>
-without the fragment is equivalent to have this in the
-corresponding file in the `$GIT_DIR/remotes/` directory.
+
+Named file in `$GIT_DIR/remotes`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can choose to provide the name of a
+file in `$GIT_DIR/remotes`. The URL
+in this file will be used to access the repository. The refspec
+in this file will be used as default when you do not
+provide a refspec on the command line. This file should have the
+following format:
+
+------------
+ URL: one of the above URL format
+ Push: <refspec>
+ Pull: <refspec>
------------
- URL: <url>
- Pull: refs/heads/master:<remote>
+`Push:` lines are used by `git-push` and
+`Pull:` lines are used by `git-pull` and `git-fetch`.
+Multiple `Push:` and `Pull:` lines may
+be specified for additional branch mappings.
+
+Named file in `$GIT_DIR/branches`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can choose to provide the name of a
+file in `$GIT_DIR/branches`.
+The URL in this file will be used to access the repository.
+This file should have the following format:
+
+
+------------
+ <url>#<head>
------------
-while having `<url>#<head>` is equivalent to
+`<url>` is required; `#<head>` is optional.
+When you do not provide a refspec on the command line,
+git will use the following refspec, where `<head>` defaults to `master`,
+and `<repository>` is the name of this file
+you provided in the command line.
------------
- URL: <url>
- Pull: refs/heads/<head>:<remote>
+ refs/heads/<head>:<repository>
------------
+
+
+
+
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index fd8cdb625a..bfde507e0e 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -4252,7 +4252,10 @@ You see, Git is actually the best tool to find out about the source of Git
itself!
[[glossary]]
-include::glossary.txt[]
+GIT Glossary
+============
+
+include::glossary-content.txt[]
[[git-quick-start]]
Appendix A: Git Quick Reference
diff --git a/git-svn.perl b/git-svn.perl
index 3a6eb1cb9d..47b0c37d17 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -177,6 +177,7 @@ my %cmd = (
'strategy|s=s' => \$_strategy,
'local|l' => \$_local,
'fetch-all|all' => \$_fetch_all,
+ 'dry-run|n' => \$_dry_run,
%fc_opts } ],
'commit-diff' => [ \&cmd_commit_diff,
'Commit a diff between two trees',
@@ -557,6 +558,11 @@ sub cmd_rebase {
die "Unable to determine upstream SVN information from ",
"working tree history\n";
}
+ if ($_dry_run) {
+ print "Remote Branch: " . $gs->refname . "\n";
+ print "SVN URL: " . $url . "\n";
+ return;
+ }
if (command(qw/diff-index HEAD --/)) {
print STDERR "Cannot rebase with uncommited changes:\n";
command_noisy('status');
@@ -745,7 +751,7 @@ sub cmd_commit_diff {
my $usage = "Usage: $0 commit-diff -r<revision> ".
"<tree-ish> <tree-ish> [<URL>]";
fatal($usage) if (!defined $ta || !defined $tb);
- my $svn_path;
+ my $svn_path = '';
if (!defined $url) {
my $gs = eval { Git::SVN->new };
if (!$gs) {
@@ -769,7 +775,6 @@ sub cmd_commit_diff {
$_message ||= get_commit_entry($tb)->{log};
}
my $ra ||= Git::SVN::Ra->new($url);
- $svn_path ||= $ra->{svn_path};
my $r = $_revision;
if ($r eq 'HEAD') {
$r = $ra->get_latest_revnum;
@@ -1918,7 +1923,7 @@ sub prop_walk {
foreach (sort keys %$dirent) {
next if $dirent->{$_}->{kind} != $SVN::Node::dir;
- $self->prop_walk($p . $_, $rev, $sub);
+ $self->prop_walk($self->{path} . $p . $_, $rev, $sub);
}
}
diff --git a/gitweb/test/Märchen b/gitweb/test/Märchen
deleted file mode 100644
index 8f7a1d3e9c..0000000000
--- a/gitweb/test/Märchen
+++ /dev/null
@@ -1,2 +0,0 @@
-Märchen
-Märchen
diff --git a/gitweb/test/file with spaces b/gitweb/test/file with spaces
deleted file mode 100644
index f108543c4e..0000000000
--- a/gitweb/test/file with spaces
+++ /dev/null
@@ -1,4 +0,0 @@
-This
-filename
-contains
-spaces.
diff --git a/gitweb/test/file+plus+sign b/gitweb/test/file+plus+sign
deleted file mode 100644
index fd05278808..0000000000
--- a/gitweb/test/file+plus+sign
+++ /dev/null
@@ -1,6 +0,0 @@
-This
-filename
-contains
-+
-plus
-chars.
diff --git a/graph.c b/graph.c
index 26b8c5209e..edfab2d5b4 100644
--- a/graph.c
+++ b/graph.c
@@ -81,6 +81,27 @@ struct git_graph {
*/
enum graph_state state;
/*
+ * The output state for the previous line of output.
+ * This is primarily used to determine how the first merge line
+ * should appear, based on the last line of the previous commit.
+ */
+ enum graph_state prev_state;
+ /*
+ * The index of the column that refers to this commit.
+ *
+ * If none of the incoming columns refer to this commit,
+ * this will be equal to num_columns.
+ */
+ int commit_index;
+ /*
+ * The commit_index for the previously displayed commit.
+ *
+ * This is used to determine how the first line of a merge
+ * graph output should appear, based on the last line of the
+ * previous commit.
+ */
+ int prev_commit_index;
+ /*
* The maximum number of columns that can be stored in the columns
* and new_columns arrays. This is also half the number of entries
* that can be stored in the mapping and new_mapping arrays.
@@ -137,6 +158,9 @@ struct git_graph *graph_init(struct rev_info *opt)
graph->num_parents = 0;
graph->expansion_row = 0;
graph->state = GRAPH_PADDING;
+ graph->prev_state = GRAPH_PADDING;
+ graph->commit_index = 0;
+ graph->prev_commit_index = 0;
graph->num_columns = 0;
graph->num_new_columns = 0;
graph->mapping_size = 0;
@@ -164,6 +188,12 @@ void graph_release(struct git_graph *graph)
free(graph);
}
+static void graph_update_state(struct git_graph *graph, enum graph_state s)
+{
+ graph->prev_state = graph->state;
+ graph->state = s;
+}
+
static void graph_ensure_capacity(struct git_graph *graph, int num_columns)
{
if (graph->column_capacity >= num_columns)
@@ -342,6 +372,7 @@ static void graph_update_columns(struct git_graph *graph)
if (col_commit == graph->commit) {
int old_mapping_idx = mapping_idx;
seen_this = 1;
+ graph->commit_index = i;
for (parent = graph->commit->parents;
parent;
parent = parent->next) {
@@ -395,6 +426,13 @@ void graph_update(struct git_graph *graph, struct commit *commit)
}
/*
+ * Store the old commit_index in prev_commit_index.
+ * graph_update_columns() will update graph->commit_index for this
+ * commit.
+ */
+ graph->prev_commit_index = graph->commit_index;
+
+ /*
* Call graph_update_columns() to update
* columns, new_columns, and mapping.
*/
@@ -404,21 +442,26 @@ void graph_update(struct git_graph *graph, struct commit *commit)
/*
* Update graph->state.
+ * Note that we don't call graph_update_state() here, since
+ * we don't want to update graph->prev_state. No line for
+ * graph->state was ever printed.
*
* If the previous commit didn't get to the GRAPH_PADDING state,
* it never finished its output. Goto GRAPH_SKIP, to print out
* a line to indicate that portion of the graph is missing.
*
- * Otherwise, if there are 3 or more parents, we need to print
- * extra rows before the commit, to expand the branch lines around
- * it and make room for it.
+ * If there are 3 or more parents, we may need to print extra rows
+ * before the commit, to expand the branch lines around it and make
+ * room for it. We need to do this only if there is a branch row
+ * (or more) to the right of this commit.
*
* If there are less than 3 parents, we can immediately print the
* commit line.
*/
if (graph->state != GRAPH_PADDING)
graph->state = GRAPH_SKIP;
- else if (graph->num_parents >= 3)
+ else if (graph->num_parents >= 3 &&
+ graph->commit_index < (graph->num_columns - 1))
graph->state = GRAPH_PRE_COMMIT;
else
graph->state = GRAPH_COMMIT;
@@ -497,10 +540,11 @@ static void graph_output_skip_line(struct git_graph *graph, struct strbuf *sb)
strbuf_addstr(sb, "...");
graph_pad_horizontally(graph, sb);
- if (graph->num_parents >= 3)
- graph->state = GRAPH_PRE_COMMIT;
+ if (graph->num_parents >= 3 &&
+ graph->commit_index < (graph->num_columns - 1))
+ graph_update_state(graph, GRAPH_PRE_COMMIT);
else
- graph->state = GRAPH_COMMIT;
+ graph_update_state(graph, GRAPH_COMMIT);
}
static void graph_output_pre_commit_line(struct git_graph *graph,
@@ -535,7 +579,22 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
if (col->commit == graph->commit) {
seen_this = 1;
strbuf_addf(sb, "| %*s", graph->expansion_row, "");
- } else if (seen_this) {
+ } else if (seen_this && (graph->expansion_row == 0)) {
+ /*
+ * This is the first line of the pre-commit output.
+ * If the previous commit was a merge commit and
+ * ended in the GRAPH_POST_MERGE state, all branch
+ * lines after graph->prev_commit_index were
+ * printed as "\" on the previous line. Continue
+ * to print them as "\" on this line. Otherwise,
+ * print the branch lines as "|".
+ */
+ if (graph->prev_state == GRAPH_POST_MERGE &&
+ graph->prev_commit_index < i)
+ strbuf_addstr(sb, "\\ ");
+ else
+ strbuf_addstr(sb, "| ");
+ } else if (seen_this && (graph->expansion_row > 0)) {
strbuf_addstr(sb, "\\ ");
} else {
strbuf_addstr(sb, "| ");
@@ -550,7 +609,7 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
*/
graph->expansion_row++;
if (graph->expansion_row >= num_expansion_rows)
- graph->state = GRAPH_COMMIT;
+ graph_update_state(graph, GRAPH_COMMIT);
}
static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)
@@ -625,10 +684,8 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
seen_this = 1;
graph_output_commit_char(graph, sb);
- if (graph->num_parents < 2)
+ if (graph->num_parents < 3)
strbuf_addch(sb, ' ');
- else if (graph->num_parents == 2)
- strbuf_addstr(sb, " ");
else {
int num_dashes =
((graph->num_parents - 2) * 2) - 1;
@@ -636,8 +693,27 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
strbuf_addch(sb, '-');
strbuf_addstr(sb, ". ");
}
- } else if (seen_this && (graph->num_parents > 1)) {
+ } else if (seen_this && (graph->num_parents > 2)) {
strbuf_addstr(sb, "\\ ");
+ } else if (seen_this && (graph->num_parents == 2)) {
+ /*
+ * This is a 2-way merge commit.
+ * There is no GRAPH_PRE_COMMIT stage for 2-way
+ * merges, so this is the first line of output
+ * for this commit. Check to see what the previous
+ * line of output was.
+ *
+ * If it was GRAPH_POST_MERGE, the branch line
+ * coming into this commit may have been '\',
+ * and not '|' or '/'. If so, output the branch
+ * line as '\' on this line, instead of '|'. This
+ * makes the output look nicer.
+ */
+ if (graph->prev_state == GRAPH_POST_MERGE &&
+ graph->prev_commit_index < i)
+ strbuf_addstr(sb, "\\ ");
+ else
+ strbuf_addstr(sb, "| ");
} else {
strbuf_addstr(sb, "| ");
}
@@ -649,11 +725,11 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
* Update graph->state
*/
if (graph->num_parents > 1)
- graph->state = GRAPH_POST_MERGE;
+ graph_update_state(graph, GRAPH_POST_MERGE);
else if (graph_is_mapping_correct(graph))
- graph->state = GRAPH_PADDING;
+ graph_update_state(graph, GRAPH_PADDING);
else
- graph->state = GRAPH_COLLAPSING;
+ graph_update_state(graph, GRAPH_COLLAPSING);
}
void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
@@ -679,9 +755,7 @@ void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
strbuf_addch(sb, '|');
for (j = 0; j < graph->num_parents - 1; j++)
strbuf_addstr(sb, "\\ ");
- if (graph->num_parents == 2)
- strbuf_addch(sb, ' ');
- } else if (seen_this && (graph->num_parents > 2)) {
+ } else if (seen_this) {
strbuf_addstr(sb, "\\ ");
} else {
strbuf_addstr(sb, "| ");
@@ -694,9 +768,9 @@ void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
* Update graph->state
*/
if (graph_is_mapping_correct(graph))
- graph->state = GRAPH_PADDING;
+ graph_update_state(graph, GRAPH_PADDING);
else
- graph->state = GRAPH_COLLAPSING;
+ graph_update_state(graph, GRAPH_COLLAPSING);
}
void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)
@@ -801,7 +875,7 @@ void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)
* Otherwise, we need to collapse some branch lines together.
*/
if (graph_is_mapping_correct(graph))
- graph->state = GRAPH_PADDING;
+ graph_update_state(graph, GRAPH_PADDING);
}
int graph_next_line(struct git_graph *graph, struct strbuf *sb)
@@ -865,6 +939,11 @@ void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
}
graph_pad_horizontally(graph, sb);
+
+ /*
+ * Update graph->prev_state since we have output a padding line
+ */
+ graph->prev_state = GRAPH_PADDING;
}
int graph_is_commit_finished(struct git_graph const *graph)
diff --git a/http-push.c b/http-push.c
index f173dcd64f..c93e781c3b 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2277,6 +2277,7 @@ int main(int argc, char **argv)
signal(SIGINT, remove_locks_on_signal);
signal(SIGHUP, remove_locks_on_signal);
signal(SIGQUIT, remove_locks_on_signal);
+ signal(SIGTERM, remove_locks_on_signal);
/* Check whether the remote has server info files */
remote->can_update_info_refs = 0;
diff --git a/lockfile.c b/lockfile.c
index cfc7335347..4023797b00 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -135,6 +135,9 @@ static int lock_file(struct lock_file *lk, const char *path)
if (0 <= lk->fd) {
if (!lock_file_list) {
signal(SIGINT, remove_lock_file_on_signal);
+ signal(SIGHUP, remove_lock_file_on_signal);
+ signal(SIGTERM, remove_lock_file_on_signal);
+ signal(SIGQUIT, remove_lock_file_on_signal);
atexit(remove_lock_file);
}
lk->owner = getpid();
diff --git a/perl/Git.pm b/perl/Git.pm
index d05b633b64..97e61efaff 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -565,7 +565,7 @@ sub config {
my $E = shift;
if ($E->value() == 1) {
# Key not found.
- return undef;
+ return;
} else {
throw $E;
}
@@ -719,9 +719,8 @@ sub ident_person {
=item hash_object ( TYPE, FILENAME )
-Compute the SHA1 object id of the given C<FILENAME> (or data waiting in
-C<FILEHANDLE>) considering it is of the C<TYPE> object type (C<blob>,
-C<commit>, C<tree>).
+Compute the SHA1 object id of the given C<FILENAME> considering it is
+of the C<TYPE> object type (C<blob>, C<commit>, C<tree>).
The method can be called without any instance or on a specified Git repository,
it makes zero difference.
diff --git a/read-cache.c b/read-cache.c
index ac9a8e7e32..8e5fbb6192 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -893,6 +893,15 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
if (ce_uptodate(ce))
return ce;
+ /*
+ * CE_VALID means the user promised us that the change to
+ * the work tree does not matter and told us not to worry.
+ */
+ if (!ignore_valid && (ce->ce_flags & CE_VALID)) {
+ ce_mark_uptodate(ce);
+ return ce;
+ }
+
if (lstat(ce->name, &st) < 0) {
if (err)
*err = errno;
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 3531a992a9..46ec1ce8aa 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -212,4 +212,18 @@ test_expect_success 'do not fire editor in the presence of conflicts' '
test "`cat .git/result`" = "editor not started"
'
+pwd=`pwd`
+cat > .git/FAKE_EDITOR << EOF
+#! /bin/sh
+# kill -TERM command added below.
+EOF
+
+test_expect_success 'a SIGTERM should break locks' '
+ echo >>negative &&
+ sh -c '\''
+ echo kill -TERM $$ >> .git/FAKE_EDITOR
+ GIT_EDITOR=.git/FAKE_EDITOR exec git commit -a'\'' && exit 1 # should fail
+ ! test -f .git/index.lock
+'
+
test_done