summaryrefslogtreecommitdiff
path: root/builtin-log.c
AgeCommit message (Collapse)Author
2007-09-14git-format-patch --in-reply-to: accept <message@id> with angle bracketsJunio C Hamano
This will allow RFC-literate users to say: format-patch --in-reply-to='<message.id@site.name>' without forcing them to strip the surrounding angle brackets like this: format-patch --in-reply-to='message.id@site.name' We accept both forms, and the latter gets necessary < and > around it as before. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-28"format-patch --root rev" is the way to show everything.Junio C Hamano
We used to trigger the special case "things not in origin" semantics only when one and only one positive ref is given, and no number (e.g. "git format-patch -4 origin") was specified, and used the general revision range semantics for everything else. This narrows the special case a bit more, by making: git format-patch --root this_version to show everything that leads to the named commit. More importantly, document the two different semantics better. The generic revision range semantics came later and bolted on without being clearly documented. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-28Porcelain level "log" family should recurse when diffing.Junio C Hamano
Most notably, "git log --name-status" stopped at top level directory changes without "-r" option. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-04Handle format.subjectprefix for every command which accepts --prettyAlex Riesen
Because the --pretty can be given as --pretty=email which historically produced mails with patches. IOW, exactly what git-format-patch does. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-03format-patch: Add format.subjectprefix config optionAdam Roben
This change lets you use the format.subjectprefix config option to override the default subject prefix. Signed-off-by: Adam Roben <aroben@apple.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-28git-log: detect dup and fdopen failureJim Meyering
This defines xdup() and xfdopen() in git-compat-util.h to give us error-catching variants of them without cluttering the code too much. Signed-off-by: Jim Meyering <jim@meyering.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-23Finally implement "git log --follow"Linus Torvalds
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-13Lift 16kB limit of log message outputJunio C Hamano
Traditionally we had 16kB limit when formatting log messages for output, because it was easier to arrange for the caller to have a reasonably big buffer and pass it down without ever worrying about reallocating. This changes the calling convention of pretty_print_commit() to lift this limit. Instead of the buffer and remaining length, it now takes a pointer to the pointer that points at the allocated buffer, and another pointer to the location that stores the allocated length, and reallocates the buffer as necessary. To support the user format, the error return of interpolate() needed to be changed. It used to return a bool telling "Ok the result fits", or "Sorry, I had to truncate it". Now it returns 0 on success, and returns the size of the buffer it wants in order to fit the whole result. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09cmd_log_init: remove parsing of --encoding command line parameterJeff King
This was moved to the setup_revisions parsing in 7cbcf4d5, so it was never being triggered. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06Add the --numbered-files option to git-format-patch.Jon Loeliger
With this option, git-format-patch will generate simple numbered files as output instead of the default using with the first commit line appended. This simplifies the ability to generate an MH-style drafts folder with each message to be sent. Signed-off-by: Jon Loeliger <jdl@freescale.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-05-15Merge branch 'maint'Junio C Hamano
* maint: Prepare for 1.5.1.5 Release Notes gitweb: Add a few comments about %feature hash git-am: Clean up the asciidoc documentation Documentation: format-patch has no --mbox option builtin-log.c: Fix typo in comment Fix git-clone buglet for remote case.
2007-05-14builtin-log.c: Fix typo in commentFrank Lichtenheld
s/fmt-patch/format-patch/ Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16Add support for "commit name decorations" to log family of commandsLinus Torvalds
This adds "--decorate" as a log option, which prints out the ref names of any commits that are shown. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-13Merge branch 'jc/cherry'Junio C Hamano
* jc/cherry: Documentation: --cherry-pick git-log --cherry-pick A...B Refactor patch-id filtering out of git-cherry and git-format-patch. Add %m to '--pretty=format:'
2007-04-13Fix git {log,show,...} --pretty=emailJunio C Hamano
An earlier --subject-prefix patch forgot that format-patch is not the only codepath that adds the "[PATCH]" prefix, and broke everybody else in the log family. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12Refactor patch-id filtering out of git-cherry and git-format-patch.Junio C Hamano
This implements the patch-id computation and recording library, patch-ids.c, and rewrites the get_patch_ids() function used in cherry and format-patch to use it, so that they do not pollute the object namespace. Earlier code threw non-objects into the in-core object database, and hoped for not getting bitten by SHA-1 collisions. While it may be practically Ok, it still was an ugly hack. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12Add custom subject prefix support to format-patch (take 3)Robin H. Johnson
Add a new option to git-format-patch, entitled --subject-prefix that allows control of the subject prefix '[PATCH]'. Using this option, the text 'PATCH' is replaced with whatever input is provided to the option. This allows easily generating patches like '[PATCH 2.6.21-rc3]' or properly numbered series like '[-mm3 PATCH N/M]'. This patch provides the implementation and documentation. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-20Replace remaining instances of strdup with xstrdup.James Bowes
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-05format-patch: add --inline option and make --attach a true attachmentJohannes Schindelin
The existing --attach option did not create a true "attachment" but multipart/mixed with Content-Disposition: inline. It should have been with Content-Disposition: attachment. Introduce --inline to add multipart/mixed that is inlined, and make --attach to create an attachement. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27convert object type handling from a string to a numberNicolas Pitre
We currently have two parallel notation for dealing with object types in the code: a string and a numerical value. One of them is obviously redundent, and the most used one requires more stack space and a bunch of strcmp() all over the place. This is an initial step for the removal of the version using a char array found in object reading code paths. The patch is unfortunately large but there is no sane way to split it in smaller parts without breaking the system. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24Merge branch 'maint'Junio C Hamano
* maint: diff-patch: Avoid emitting double-slashes in textual patch. Reword git-am 3-way fallback failure message. Limit filename for format-patch core.legacyheaders: Use the description used in RelNotes-1.5.0 git-show-ref --verify: Fail if called without a reference Conflicts: builtin-show-ref.c diff.c
2007-02-24Limit filename for format-patchRobin Rosenberg
Badly formatted commits may have very long comments. This causes git-format-patch to fail. To avoid that, truncate the filename to a value we believe will always work. Err out if the patch file cannot be created. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-21Mechanical conversion to use prefixcmp()Junio C Hamano
This mechanically converts strncmp() to use prefixcmp(), but only when the parameters match specific patterns, so that they can be verified easily. Leftover from this will be fixed in a separate step, including idiotic conversions like if (!strncmp("foo", arg, 3)) => if (!(-prefixcmp(arg, "foo"))) This was done by using this script in px.perl #!/usr/bin/perl -i.bak -p if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) { s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|; } if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) { s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|; } and running: $ git grep -l strncmp -- '*.c' | xargs perl px.perl Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-08git reflog showLinus Torvalds
It makes "git reflog [show]" act as git log -g --pretty=oneline --abbrev-cmit and is fairly straightforward. So you can just write git reflog or git reflog show and it will show you the reflog in a nice format. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28Don't force everybody to call setup_ident().Junio C Hamano
Back when only handful commands that created commit and tag were the only users of committer identity information, it made sense to explicitly call setup_ident() to pre-fill the default value from the gecos information. But it is much simpler for programs to make the call automatic when get_ident() is called these days, since many more programs want to use the information when updating the reflog. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-26Allow non-developer to clone, checkout and fetch more easily.Junio C Hamano
The code that uses committer_info() in reflog can barf and die whenever it is asked to update a ref. And I do not think calling ignore_missing_committer_name() upfront like recent receive-pack did in the aplication is a reasonable workaround. What the patch does. - git_committer_info() takes one parameter. It used to be "if this is true, then die() if the name is not available due to bad GECOS, otherwise issue a warning once but leave the name empty". The reason was because we wanted to prevent bad commits from being made by git-commit-tree (and its callers). The value 0 is only used by "git var -l". Now it takes -1, 0 or 1. When set to -1, it does not complain but uses the pw->pw_name when name is not available. Existing 0 and 1 values mean the same thing as they used to mean before. 0 means issue warnings and leave it empty, 1 means barf and die. - ignore_missing_committer_name() and its existing caller (receive-pack, to set the reflog) have been removed. - git-format-patch, to come up with the phoney message ID when asked to thread, now passes -1 to git_committer_info(). This codepath uses only the e-mail part, ignoring the name. It used to barf and die. The other call in the same program when asked to add signed-off-by line based on committer identity still passes 1 to make sure it barfs instead of adding a bogus s-o-b line. - log_ref_write in refs.c, to come up with the name to record who initiated the ref update in the reflog, passes -1. It used to barf and die. The last change means that git-update-ref, git-branch, and commit walker backends can now be used in a repository with reflog by somebody who does not have the user identity required to make a commit. They all used to barf and die. I've run tests and all of them seem to pass, and also tried "git clone" as a user whose GECOS is empty -- git clone works again now (it was broken when reflog was enabled by default). But this definitely needs extra sets of eyeballs. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-23format-patch: fix bug with --stdout in a subdirectoryJeff King
We set the output directory to the git subdirectory prefix if one has not already been specified. However, in the case of --stdout, we explicitly _don't_ want the output directory to be set. The result was that "git-format-patch --stdout" in a directory besides the project root produced the "standard output, or directory, which one?" error message. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21--walk-reflogs: do not crash with cyclic reflog ancestryJohannes Schindelin
Since you can reset --hard to any revision you already had, when traversing the reflog ancestry, we may not free() the commit buffer. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18git-format-patch: the default suffix is now .patch, not .txtJunio C Hamano
Editors often give easier handling of patch files if the filename ends with .patch, so use it instead of .txt. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18git-format-patch: make --binary on by defaultJunio C Hamano
It does not make much sense to generate a patch that cannot be applied. If --text is specified on the command line it still takes precedence. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18Add --summary to git-format-patch by defaultJunio C Hamano
This adds --summary output in addition to the --stat to the output from git-format-patch by default. I think additions, removals and filemode changes are rare but notable events and always showing it makes sense. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18git-format-patch -3Junio C Hamano
This teaches "git-format-patch" to honor the --max-count parameter revision traversal machinery takes, so that you can say "git-format-patch -3" to process the three topmost commits from the current HEAD (or "git-format-patch -2 topic" to name a specific branch). Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-17git-format-patch: do not crash with format.headers without value.Junio C Hamano
An incorrect config file can say: [format] headers and crash the parsing. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-17Introduce 'git-format-patch --suffix=.patch'Junio C Hamano
The default can also be changed with "format.suffix" configuration. Leaving it empty would not add any suffix. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28UTF-8: introduce i18n.logoutputencoding.Junio C Hamano
It is plausible for somebody to want to view the commit log in a different encoding from i18n.commitencoding -- the project's policy may be UTF-8 and the user may be using a commit message hook to run iconv to conform to that policy (and either not have i18n.commitencoding to default to UTF-8 or have it explicitly set to UTF-8). Even then, Latin-1 may be more convenient for the usual pager and the terminal the user uses. The new variable i18n.logoutputencoding is used in preference to i18n.commitencoding to decide what encoding to recode the log output in when git-log and friends formats the commit log message. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-26Teach log family --encodingJunio C Hamano
Updated commit objects record the encoding used in their encoding header. This updates the log family to reencode it into the encoding specified in i18n.commitencoding (or the default, which is "utf-8") upon output. To force a specific encoding that is different, log family takes command line flag --encoding=<encoding>; giving --encoding=none entirely disables the reencoding and lets you view log messges in their original encoding. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20simplify inclusion of system header files.Junio C Hamano
This is a mechanical clean-up of the way *.c files include system header files. (1) sources under compat/, platform sha-1 implementations, and xdelta code are exempt from the following rules; (2) the first #include must be "git-compat-util.h" or one of our own header file that includes it first (e.g. config.h, builtin.h, pkt-line.h); (3) system headers that are included in "git-compat-util.h" need not be included in individual C source files. (4) "git-compat-util.h" does not have to include subsystem specific header files (e.g. expat.h). Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14git-show: grok blobs, trees and tags, tooJohannes Schindelin
Since git-show is pure Porcelain, it is the ideal candidate to pretty print other things than commits, too. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13Allow subcommand.color and color.subcommand color configurationAndy Parkins
While adding colour to the branch command it was pointed out that a config option like "branch.color" conflicts with the pre-existing "branch.something" namespace used for specifying default merge urls and branches. The suggested solution was to flip the order of the components to "color.branch", which I did for colourising branch. This patch does the same thing for - git-log (color.diff) - git-status (color.status) - git-diff (color.diff) - pager (color.pager) I haven't removed the old config options; but they should probably be deprecated and eventually removed to prevent future namespace collisions. I've done this deprecation by changing the documentation for the config file to match the new names; and adding the "color.XXX" options to contrib/completion/git-completion.bash. Unfortunately git-svn reads "diff.color" and "pager.color"; which I don't like to change unilaterally. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24config option log.showroot to show the diff of root commitsPeter Baumann
This allows one to see a root commit as a diff in commands like git-log, git-show and git-whatchanged. Signed-off-by: Peter Baumann <Peter.B.Baumannn@stud.informatik.uni-erlangen.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-27Make git-cherry handle root treesRene Scharfe
This patch on top of 'next' makes built-in git-cherry handle root commits. It moves the static function log-tree.c::diff_root_tree() to tree-diff.c and makes it more similar to diff_tree_sha1() by shuffling around arguments and factoring out the call to log_tree_diff_flush(). Consequently the name is changed to diff_root_tree_sha1(). It is a version of diff_tree_sha1() that compares the empty tree (= root tree) against a single 'real' tree. This function is then used in get_patch_id() to compute patch IDs for initial commits instead of SEGFAULTing, as the current code does if confronted with parentless commits. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-24Built-in cherryRene Scharfe
This replaces the shell script git-cherry with a version written in C. The behaviour of the new version differs from the original in two points: it has no long help any more, and it is handling the (optional) third parameter a bit differently. Basically, it does the equivalent of ours=`git-rev-list $ours ^$limit ^$upstream` instead of ours=`git-rev-list $ours ^$limit` Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-29git-format-patch: fix bug using -o in subdirectoriesMatthias Lederhofer
This was introduced by me in commit v1.4.2.1-gc08e524. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28format-patch: use cwd as default output directoryMatthias Lederhofer
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27Use xrealloc instead of reallocJonas Fonseca
Change places that use realloc, without a proper error path, to instead use xrealloc. Drop an erroneous error path in the daemon code that used errno in the die message in favour of the simpler xrealloc. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-05Allow config file to specify Signed-off-by identity in format-patch.Ramsay Jones
Unlike git-commit, git-format-patch was not picking up and using the user.email config variable for the email part of the committer info. I was forced to use the GIT_COMMITTER_EMAIL environment variable to override the default <user@localhost.localdomain>. The fix was to simply move the call to setup_ident() to come before the git_config() call. Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31Builtins: control the use of pager from the command table.Junio C Hamano
This moves the built-in "always-use-pager" logic for log family to the command dispatch table of git wrapper. This makes it easier to change the default use of pager, and has an added benefit that we fork and exec the pager early before packs are mmapped. Pointed out by Juergen Ruehle <j.ruehle@bmiag.de>. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-29Call setup_git_directory() much earlierLinus Torvalds
This changes the calling convention of built-in commands and passes the "prefix" (i.e. pathname of $PWD relative to the project root level) down to them. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-29Call setup_git_directory() earlyLinus Torvalds
Any git command that expects to work in a subdirectory of a project, and that reads the git config files (which is just about all of them) needs to make sure that it does the "setup_git_directory()" call before it tries to read the config file. This means, among other things, that we need to move the call out of "init_revisions()", and into the caller. This does the mostly trivial conversion to do that. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-28log and diff family: honor config even from subdirectoriesJunio C Hamano
There currently is an unfortunate circular dependency between what init_revisions (the command line revision specification parser) does and setting up the log and diff options. The function uses setup_git_directory() to find the root of the project relative to the current directory and calls diff_setup() to prepare diff generation. However, some of the things that diff_setup() does needs to depend on the configuration variable, which needs to be read after setup_git_directory() is called. This patch is a low impact workaround. It first lets init_revisions() to run and do its thing, then uses git_config() and diff_setup() after it returns, so that configuration variables that affects the diff operation can be used from subdirectories. Signed-off-by: Junio C Hamano <junkio@cox.net>