1
0
mirror of https://github.com/git/git.git synced 2024-10-03 16:22:22 +02:00
Commit Graph

10733 Commits

Author SHA1 Message Date
Linus Torvalds
750f7b668f Finally implement "git log --follow"
Ok, I've really held off doing this too damn long, because I'm lazy, and I
was always hoping that somebody else would do it.

But no, people keep asking for it, but nobody actually did anything, so I
decided I might as well bite the bullet, and instead of telling people
they could add a "--follow" flag to "git log" to do what they want to do,
I decided that it looks like I just have to do it for them..

The code wasn't actually that complicated, in that the diffstat for this
patch literally says "70 insertions(+), 1 deletions(-)", but I will have
to admit that in order to get to this fairly simple patch, you did have to
know and understand the internal git diff generation machinery pretty
well, and had to really be able to follow how commit generation interacts
with generating patches and generating the log.

So I suspect that while I was right that it wasn't that hard, I might have
been expecting too much of random people - this patch does seem to be
firmly in the core "Linus or Junio" territory.

To make a long story short: I'm sorry for it taking so long until I just
did it.

I'm not going to guarantee that this works for everybody, but you really
can just look at the patch, and after the appropriate appreciative noises
("Ooh, aah") over how clever I am, you can then just notice that the code
itself isn't really that complicated.

All the real new code is in the new "try_to_follow_renames()" function. It
really isn't rocket science: we notice that the pathname we were looking
at went away, so we start a full tree diff and try to see if we can
instead make that pathname be a rename or a copy from some other previous
pathname. And if we can, we just continue, except we show *that*
particular diff, and ever after we use the _previous_ pathname.

One thing to look out for: the "rename detection" is considered to be a
singular event in the _linear_ "git log" output! That's what people want
to do, but I just wanted to point out that this patch is *not* carrying
around a "commit,pathname" kind of pair and it's *not* going to be able to
notice the file coming from multiple *different* files in earlier history.

IOW, if you use "git log --follow", then you get the stupid CVS/SVN kind
of "files have single identities" kind of semantics, and git log will just
pick the identity based on the normal move/copy heuristics _as_if_ the
history could be linearized.

Put another way: I think the model is broken, but given the broken model,
I think this patch does just about as well as you can do. If you have
merges with the same "file" having different filenames over the two
branches, git will just end up picking _one_ of the pathnames at the point
where the newer one goes away. It never looks at multiple pathnames in
parallel.

And if you understood all that, you probably didn't need it explained, and
if you didn't understand the above blathering, it doesn't really mtter to
you. What matters to you is that you can now do

	git log -p --follow builtin-rev-list.c

and it will find the point where the old "rev-list.c" got renamed to
"builtin-rev-list.c" and show it as such.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 23:37:11 -07:00
Junio C Hamano
4d9b580763 Merge branch 'jc/oneline'
* jc/oneline:
  pp_header(): work around possible memory corruption
2007-06-22 23:33:08 -07:00
Junio C Hamano
9bee7aabcd Merge branch 'ei/oneline+add-empty'
* ei/oneline+add-empty:
  Fix ALLOC_GROW calls with obsolete semantics
  Fix ALLOC_GROW off-by-one
  builtin-add: simplify (and increase accuracy of) exclude handling
  dir_struct: add collect_ignored option
  Extend --pretty=oneline to cover the first paragraph,
  Lift 16kB limit of log message output
2007-06-22 23:32:19 -07:00
Johannes Schindelin
55f22ff22e filter-branch: add example to move everything into a subdirectory
This is based on Jeff King's example in

	20070621130137.GB4487@coredump.intra.peff.net

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 23:20:44 -07:00
Junio C Hamano
0f2890acd9 Merge branch 'js/filter'
* js/filter:
  filter-branch: subdirectory filter needs --full-history
  filter-branch: Simplify parent computation.
  Teach filter-branch about subdirectory filtering
  filter-branch: also don't fail in map() if a commit cannot be mapped
  filter-branch: Use rev-list arguments to specify revision ranges.
  filter-branch: fix behaviour of '-k'
  filter-branch: use $(($i+1)) instead of $((i+1))
  chmod +x git-filter-branch.sh
  filter-branch: prevent filters from reading from stdin
  t7003: make test repeatable
  Add git-filter-branch
2007-06-22 23:20:40 -07:00
Junio C Hamano
63daae47e5 Two trivial -Wcast-qual fixes
Luiz Fernando N. Capitulino noticed the one in tree-walk.h where
we cast away constness while computing the legnth of a tree
entry.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 23:19:43 -07:00
Johannes Schindelin
0ce396431e diffcore-rename: favour identical basenames
When there are several candidates for a rename source, and one of them
has an identical basename to the rename target, take that one.

Noticed by Govind Salinas, posted by Shawn O. Pearce, partial patch
by Linus Torvalds.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 22:43:51 -07:00
Shawn O. Pearce
37cd4f7e82 Document git-gui, git-citool as mainporcelain manual pages
Jakub Narebski pointed out that the git-gui blame viewer is not a
widely known feature, but is incredibly useful.  Part of the issue
is advertising.  Up until now we haven't even referenced git-gui from
within the core Git manual pages, mostly because I just wasn't sure
how I wanted to supply git-gui documentation to end-users, or how
that documentation should integrate with the core Git documentation.

Based upon Jakub's comment that many users may not even know that
the gui is available in a stock Git distribution I'm offering up
two basic manual pages: git-citool and git-gui.  These should offer
enough of a starting point for users to identify that the gui exists,
and how to start it.  Future releases of git-gui may contain their
own documentation system available from within a running git-gui.
But not today.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 22:32:32 -07:00
Dave O'Neill
47ee8ed292 Generate tags with correct timestamp (git-svnimport)
Now uses git-tag instead of manually constructing the tag.  This gives us a
correct timestamp, removes some crufty code, and makes it work the same as
git-cvsimport.

The generated tags are now lightweight tags instead of tag objects, which may
or may not be the behaviour we want.

Also, remove two unused variables from git-cvsimport.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 22:13:49 -07:00
Shawn O. Pearce
610f043bb3 Import branch 'git-p4' of git://repo.or.cz/fast-export
Simon has asked that the git.git project include the git-p4 project
as at least a contrib/fast-import within git.git.  I think it makes
a lot of sense, as git-p4 nicely complements the only other in-tree
fast-import user: import-tars.perl.

git-p4 is offered under the MIT license by its authors.
2007-06-22 19:16:22 -04:00
Shawn O. Pearce
92d7c8e37b Avoid src:dst syntax as default bash completion for git push
Raimund Bauer just discovered that the default bash completion for
a local branch name in a git-push line is not the best choice when
the branch does not exist on the remote system.

In the past we have always completed the local name 'test' as
"test:test", indicating that the destination name is the same as
the local name.  But this fails when "test" does not yet exist on
the remote system, as there is no "test" branch for it to match
the name against.

Fortunately git-push does the right thing when given just the
local branch, as it assumes you want to use the same name in the
destination repository.  So we now offer "test" as the completion
in a git-push line, and let git-push assume that is also the remote
branch name.

We also still support the remote branch completion after the :,
but only if the user manually adds the colon before trying to get
a completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-22 18:44:04 -04:00
Shawn O. Pearce
4e817d1ac4 git-gui: Don't require $DISPLAY just to get --version
Junio asked that we don't force the user to have a valid X11 server
configured in $DISPLAY just to obtain the output of `git gui version`.
This makes sense, the user may be an automated tool that is running
without an X server available to it, such as a build script or other
sort of package management system.  Or it might just be a user working
in a non-GUI environment and wondering "what version of git-gui do I
have installed?".

Tcl has a lot of warts, but one of its better ones is that a comment
can be continued to the next line by escaping the LF that would have
ended the comment using a backslash-LF sequence.  In the past we have
used this trick to escape away the 'exec wish' that is actually a Bourne
shell script and keep Tcl from executing it.

I'm using that feature here to comment out the Bourne shell script and
hide it from the Tcl engine.  Except now our Bourne shell script is a
few lines long and checks to see if it should print the version, or not.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-22 01:10:12 -04:00
Simon Hausmann
9ceab36375 Make it possible to specify the HEAD for the internal findUpstreamBranchPoint function.
This isn't used right now in git-p4 but I use it in an external script that loads git-p4 as module.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-22 00:00:34 +02:00
Shawn O. Pearce
fe813d4e80 Merge branch 'maint'
* maint:
  git-gui: Bind Tab/Shift-Tab to cycle between panes in blame
  git-gui: Correctly install to /usr/bin on Cygwin
2007-06-20 23:27:08 -04:00
Shawn O. Pearce
573fe6d77d git-gui: Quiet our installation process
Alex Riesen wanted a quieter installation process for git and its
contained git-gui.  His earlier patch to do this failed to work
properly when V=1, and didn't really give a great indication of
what the installation was doing.

These rules are a little bit on the messy side, as each of our
install actions is composed of at least two variables, but in the
V=1 case the text is identical to what we had before, while in the
non-V=1 case we use some more complex rules to show the interesting
details, and hide the less interesting bits.

We now can also set QUIET= (nothing) to see the rules that are used
when V= (nothing), so we can debug those too if we have to.  This is
actually a side-effect of how we insert the @ into the rules we use
for the "lists of things", like our builtins or our library files.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-20 23:26:57 -04:00
Shawn O. Pearce
fb626dc000 git-gui: Bind Tab/Shift-Tab to cycle between panes in blame
The blame viewer is composed of two different areas, the file
area on top and the commit area on the bottom.  If users are
trying to shift the focus it is probably because they want to
shift from one area to the other, so we just setup Tab and
Shift-Tab to jump from the one half to the other in a cycle.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-20 23:25:23 -04:00
Shawn O. Pearce
82a2d6bdf9 git-gui: Correctly install to /usr/bin on Cygwin
Mark Levedahl <mlevedahl@gmail.com> noted that installation on Cygwin
to /usr/bin can cause problems with the automatic guessing of our
library location.  The problem is that installation to /usr/bin
means we actually have:

  /usr/bin   = c:\cygwin\bin
  /usr/share = c:\cygwin\usr\share

So git-gui guesses that its library should be found within the
c:\cygwin\share directory, as that is where it should be relative
to the script itself in c:\cygwin\bin.

In my first version of this patch I tried to use `cygpath` to resolve
/usr/bin and /usr/share to test that they were in the same relative
locations, but that didn't work out correctly as we were actually
testing /usr/share against itself, so it always was equal, and we
always used relative paths.  So my original solution was quite wrong.

Mark suggested we just always disable relative behavior on Cygwin,
because of the complexity of the mount mapping problem, so that's
all I'm doing.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-20 23:22:49 -04:00
Nanako Shiraishi
6762079a96 Cloning from a repo without "current branch"
If the remote repository does not have a "current branch", git-clone
was confused and did not set up the resulting new repository
correctly.  It did not reset HEAD from the default 'master', and did
not write the SHA1 to the master branch.

Signed-off-by: Nanako Shiraishi <nanako3@bluebottle.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-20 16:33:24 -07:00
Ismail Dönmez
45fd8bd32d Change default man page path to /usr/share/man
According to FHS,

    http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREMANMANUALPAGES

default man page path is $prefix/share/man.

Signed-off-by: Ismail Donmez <ismail@pardus.org.tr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-20 16:22:09 -07:00
Junio C Hamano
a90918e824 INSTALL: explain how to build documentation
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-20 16:22:09 -07:00
Alex Riesen
3c740268c4 cvsserver: Actually implement --export-all
Frank Lichtenheld, Fri, Jun 15, 2007 03:01:53 +0200:
> +test_expect_failure 'req_Root failure (export-all w/o whitelist)' \
> +  'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1
> +   || false'

This does not work, at least for bash in current Ubuntu:

    GNU bash, version 3.2.13(1)-release

You have to put "||" on the previous line:

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-20 16:22:09 -07:00
Simon Hausmann
09d89de2e3 Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-20 23:13:20 +02:00
Simon Hausmann
1a2edf4e8d Warn about conflicting p4 branch mappings and use the first one found.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 15:10:24 +02:00
Simon Hausmann
6555b2ccfe Fix the branch mapping detection to be independent from the order of the "p4 branches" output.
Collect "unknown" source branches separately and register them at the end.

Also added a minor speed up to splitFilesIntoBranches by breaking out of the loop through all branches when it's safe.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 11:25:59 +02:00
Jeff King
25fd2f7a31 Fix ALLOC_GROW calls with obsolete semantics
ALLOC_GROW now expects the 'nr' argument to be "how much you
want" and not "how much you have". This fixes all cases
where we weren't previously adding anything to the 'nr'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 18:00:07 -07:00
Junio C Hamano
1a15fed84a Merge branch 'jk/add-empty' into ei/oneline+add-empty
* jk/add-empty:
  builtin-add: simplify (and increase accuracy of) exclude handling
  dir_struct: add collect_ignored option
2007-06-16 17:58:28 -07:00
Johannes Schindelin
4cd008a925 pp_header(): work around possible memory corruption
add_user_info() possibly adds way more than just the commit header line.
In fact, it sometimes needs so much more space that there is a buffer
overrun, leading to an ugly crash. For example, the date is printed in its
own line, and usually takes up more space than the equivalent Unix epoch.

So, for good measure, add 80 characters (a full line) to the allocated
space, in addition to the header line length.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 17:55:58 -07:00
Jeff King
c927e6c69b Fix ALLOC_GROW off-by-one
The ALLOC_GROW macro will never let us fill the array completely,
instead allocating an extra chunk if that would be the case. This is
because the 'nr' argument was originally treated as "how much we do have
now" instead of "how much do we want". The latter makes much more
sense because you can grow by more than one item.

This off-by-one never resulted in an error because it meant we were
overly conservative about when to allocate. Any callers which passed
"how much we have now" need to be updated, or they will fail to allocate
enough.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 17:55:44 -07:00
Jakub Narebski
2e88c26626 Document git log --full-diff
Based on description of commit 477f2b41310c4b1040a9e7f72720b9c39d82caf9
"git log --full-diff" adding this option.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:10:52 -07:00
Jakub Narebski
13120fdc5e Document git log --abbrev-commit, as a kind of pretty option
Documentation taken from paraphrased description of "--abbrev[=<n>]"
diff option, and from description of commit 5c51c985 introducing
this option.

Note that to change number of digits one must use "--abbrev=<n>",
which affects [also] diff output.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:10:49 -07:00
Jakub Narebski
ef3cb65c21 Use tabs for indenting definition list for options in git-log.txt
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:10:28 -07:00
Jakub Narebski
e3c1500fcf Document git rev-list --timestamp
Note that git log does not understand this option yet:

  $ git log --timestamp
  fatal: unrecognized argument: --timestamp

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:08:14 -07:00
Jakub Narebski
cb877cd7b6 Document git reflog --stale-fix
Document --stale-fix, used in "git reflog expire --stale-fix --all"
to remove invalid reflog entries, to fix situation after running
non reflog-aware git-prune from an older git in the presence of
reflogs (see RelNotes-1.5.0.txt).

Based on description of commit 1389d9ddaa68a4cbf5018d88f971b9bbb7aaa3c9
  "reflog expire --fix-stale"
which introduced this option.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:08:12 -07:00
Jakub Narebski
c9bf7be238 Document git rev-parse --is-inside-git-dir
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:08:11 -07:00
Jakub Narebski
6da0878302 Document git read-tree --trivial
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:08:09 -07:00
Jakub Narebski
29a6c3f804 Document git rev-list --full-history
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 13:08:05 -07:00
Benjamin Sergeant
da4a660161 git-p4 fails when cloning a p4 depo.
A perforce command with all the files in the repo is generated to get
all the file content.
Here is a patch to break it into multiple successive perforce command
who uses 4K of parameter max, and collect the output for later.

It works, but not for big depos, because the whole perforce depo
content is stored in memory in P4Sync.run(), and it looks like mine is
bigger than 2 Gigs, so I had to kill the process.

[Simon: I added the bit about using SC_ARG_MAX, as suggested by Han-Wen]

Signed-off-by: Benjamin Sergeant <bsergean@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-16 22:06:06 +02:00
Alex Riesen
7cbf2f24ee Do not use h_errno after connect(2): the function does not set it
Randal L. Schwartz noticed compilation problems on SunOS, which made
me look at the code again. The thing is, h_errno is not used by
connect(2), it is only for functions from netdb.h, like gethostbyname.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 09:11:58 -07:00
Junio C Hamano
3e48af3875 Documentation: update "stale" links for 1.5.2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 09:10:18 -07:00
Simon Hausmann
3c699645f5 Fix initial multi-branch import.
The list of existing p4 branches in git wasn't initialized.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-16 13:09:21 +02:00
Junio C Hamano
952c8c5638 Merge branch 'jc/remote'
* jc/remote:
  git-push: Update description of refspecs and add examples
  remote.c: "git-push frotz" should update what matches at the source.
  remote.c: fix "git push" weak match disambiguation
  remote.c: minor clean-up of match_explicit()
  remote.c: refactor creation of new dst ref
  remote.c: refactor match_explicit_refs()
2007-06-16 01:22:45 -07:00
Junio C Hamano
5c088a22e2 Merge branch 'gp/branch'
* gp/branch:
  git-branch: cleanup config file when deleting branches
2007-06-16 01:22:43 -07:00
Junio C Hamano
57bd934ea6 Merge branch 'fl/cvsserver'
* fl/cvsserver:
  cvsserver: Actually implement --export-all
  cvsserver: Let --base-path and pserver get along just fine
  cvsserver: Add some useful commandline options
2007-06-16 01:22:38 -07:00
Junio C Hamano
ad2a2f6f0b Merge branch 'lh/submodule'
* lh/submodule:
  gitmodules(5): remove leading period from synopsis
  Add gitmodules(5)
  git-submodule: give submodules proper names
  Rename sections from "module" to "submodule" in .gitmodules
  git-submodule: remember to checkout after clone
  t7400: barf if git-submodule removes or replaces a file
2007-06-16 01:22:35 -07:00
Junio C Hamano
5bd148bfe8 Merge branch 'maint' to sync with GIT 1.5.2.2 2007-06-16 01:22:10 -07:00
Sam Vilain
c5f71ad099 git-svn: avoid string eval for defining functions
You don't need to use string eval to define new functions; assigning a
code reference to the target symbol table is enough.

Acked-by: Eric Wong <normalperson@yhbt.net>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 01:20:26 -07:00
Daniel Barkalow
efd8f793e4 Fix pushing to a pattern with no dst
Refspecs with no colons are left with no dst value, because they are
interepreted differently for fetch and push. For push, they mean to
reuse the src side. Fix this for patterns.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 01:20:26 -07:00
Junio C Hamano
c7c84859ad GIT 1.5.2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.5.2.2
2007-06-16 01:13:35 -07:00
Junio C Hamano
4c7100a9f4 Documentation: adjust to AsciiDoc 8
It turns out that the attribute definition we have had for a
long time to hide "^" character from AsciiDoc 7 was not honored
by AsciiDoc 8 even under "-a asciidoc7compatible" mode.  There is
a similar breakage with the "compatible" mode with + characters.

The double colon at the end of definition list term needs
to be attached to the term, without a whitespace.  After this
minimum fixups, AsciiDoc 8 (I used 8.2.1 on Debian) with
compatibility mode seems to produce reasonably good results.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 01:11:16 -07:00
Junio C Hamano
66e41f7b99 Avoid diff cost on "git log -z"
Johannes and Marco discovered that "git log -z" spent cycles in diff even
though there is no need to actually compute diffs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15 23:48:35 -07:00