summaryrefslogtreecommitdiff
path: root/builtin-log.c
AgeCommit message (Collapse)AuthorFilesLines
2009-08-18git-log: allow --decorate[=short|full]Libravatar Lars Hjemli1-2/+14
Commit de435ac0 changed the behavior of --decorate from printing the full ref (e.g., "refs/heads/master") to a shorter, more human-readable version (e.g., just "master"). While this is nice for human readers, external tools using the output from "git log" may prefer the full version. This patch introduces an extension to --decorate to allow the caller to specify either the short or the full versions. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-16Merge branch 'js/maint-cover-letter-non-ascii'Libravatar Junio C Hamano1-0/+4
* js/maint-cover-letter-non-ascii: Correctly mark cover letters' encodings if they are not pure ASCII Expose the has_non_ascii() function
2009-08-10Correctly mark cover letters' encodings if they are not pure ASCIILibravatar Johannes Schindelin1-0/+4
If your name is, say, Üwë, you want your cover letters to appear correctly. Convince format-patch to mark it as 8-bit. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-07Show usage string for 'git log -h', 'git show -h' and 'git diff -h'Libravatar Matthieu Moy1-0/+6
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-19show: add space between multiple itemsLibravatar Jeff King1-0/+6
When showing an annotated tag, "git show" will always display the pointed-to object. However, it didn't separate the two with whitespace, making it more difficult to notice where the new object started. For example: $ git tag -m 'my message' foo $ git show foo tag foo Tagger: Jeff King <peff@peff.net> Date: Fri Jul 17 18:46:25 2009 -0400 my message commit 41cabf8fed2694ba33e01d64f9094f2fc5e5805a Author: Jeff King <peff@peff.net> Date: Thu Jul 16 17:31:34 2009 -0400 ... This patch respects and sets the rev.shown_one member to prepend a blank line before showing a second item. We use this member of rev_info instead of a local flag, because the log_tree_commit we call into for showing commits already respects and sets that flag. Meaning that everything will be spaced properly if you intermix commits and tags, like: $ git show v1.6.3 v1.6.2 HEAD In that case, a single blank line will separate the first tag, the commit it points to, the second tag, the commit that one points to, and the final commit. While we're at it, let's also support trees, so that even something as crazy as $ git show HEAD^{tree} HEAD~1^{tree} HEAD will also be spaced in an easy-to-read way. However, we intentionally do _not_ insert blank lines for blobs, so that specifying multiple blobs gives a strict concatenation. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-19show: suppress extra newline when showing annotated tagLibravatar Jeff King1-1/+1
When showing a tag, our header parsing finishes with the offset pointing to the newline separating the tag header from the tag body. This means that the printed body will always start with a newline. However, we also add an extra newline when printing the tagger information. This leads to an ugly double-newline: $ git show v1.6.3 tag v1.6.3 Tagger: Junio C Hamano <gitster@pobox.com> Date: Wed May 6 18:16:47 2009 -0700 GIT 1.6.3 -----BEGIN PGP SIGNATURE----- ... This patch removes the extra newline from the end of the tagger headers. This is a better solution than suppressing the separator newline, because it retains the behavior for tags which have no tagger. E.g., "git show v0.99" will continue to look like: $ git show v0.99 tag v0.99 Test-release for wider distribution. ... Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06Merge branch 'tr/die_errno'Libravatar Junio C Hamano1-2/+2
* tr/die_errno: Use die_errno() instead of die() when checking syscalls Convert existing die(..., strerror(errno)) to die_errno() die_errno(): double % in strerror() output just in case Introduce die_errno() that appends strerror(errno) to die()
2009-06-27Use die_errno() instead of die() when checking syscallsLibravatar Thomas Rast1-2/+2
Lots of die() calls did not actually report the kind of error, which can leave the user confused as to the real problem. Use die_errno() where we check a system/library call that sets errno on failure, or one of the following that wrap such calls: Function Passes on error from -------- -------------------- odb_pack_keep open read_ancestry fopen read_in_full xread strbuf_read xread strbuf_read_file open or strbuf_read_file strbuf_readlink readlink write_in_full xwrite Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20Fix various sparse warnings in the git source codeLibravatar Linus Torvalds1-2/+2
There are a few remaining ones, but this fixes the trivial ones. It boils down to two main issues that sparse complains about: - warning: Using plain integer as NULL pointer Sparse doesn't like you using '0' instead of 'NULL'. For various good reasons, not the least of which is just the visual confusion. A NULL pointer is not an integer, and that whole "0 works as NULL" is a historical accident and not very pretty. A few of these remain: zlib is a total mess, and Z_NULL is just a 0. I didn't touch those. - warning: symbol 'xyz' was not declared. Should it be static? Sparse wants to see declarations for any functions you export. A lack of a declaration tends to mean that you should either add one, or you should mark the function 'static' to show that it's in file scope. A few of these remain: I only did the ones that should obviously just be made static. That 'wt_status_submodule_summary' one is debatable. It has a few related flags (like 'wt_status_use_color') which _are_ declared, and are used by builtin-commit.c. So maybe we'd like to export it at some point, but it's not declared now, and not used outside of that file, so 'static' it is in this patch. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31Merge branch 'sb/opt-filename'Libravatar Junio C Hamano1-1/+1
* sb/opt-filename: parse-opts: add OPT_FILENAME and transition builtins parse-opts: prepare for OPT_FILENAME Conflicts: builtin-log.c
2009-05-31Merge branch 'sb/format-patch-parseopt'Libravatar Junio C Hamano1-100/+160
* sb/format-patch-parseopt: format-patch: migrate to parse-options API Conflicts: builtin-log.c
2009-05-30t9139 uses ancient, backwards-compatible iconv namesLibravatar Eric Wong1-1/+1
This resolves a semantic conflicts early to work with 5ae93df (t3900: use ancient iconv names for backward compatibility, 2009-05-18). Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25parse-opts: prepare for OPT_FILENAMELibravatar Stephen Boyd1-1/+1
To give OPT_FILENAME the prefix, we pass the prefix to parse_options() which passes the prefix to parse_options_start() which sets the prefix member of parse_opts_ctx accordingly. If there isn't a prefix in the calling context, passing NULL will suffice. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25Merge branch 'sb/format-patch-parseopt' into sb/opt-filenameLibravatar Junio C Hamano1-100/+160
* sb/format-patch-parseopt: format-patch: migrate to parse-options API Conflicts: builtin-log.c
2009-05-18Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibilityLibravatar Brandon Casey1-1/+1
Some ancient platforms (Solaris 7, IRIX 6.5) do not understand 'utf-8', but all tested implementations understand 'UTF-8'. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-17format-patch: migrate to parse-options APILibravatar Stephen Boyd1-97/+158
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09format-patch let -k override a config-specified format.numberedLibravatar Jim Meyering1-1/+13
Let a command-line --keep-subject (-k) override a config-specified format.numbered (--numbered (-n)), rather than provoking the "-n and -k are mutually exclusive" failure. * t4021-format-patch-numbered.sh: Test for the above Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-06Merge branch 'sb/format-patch-patchname'Libravatar Junio C Hamano1-88/+43
* sb/format-patch-patchname: format_sanitized_subject: Don't trim past initial length of strbuf log-tree: fix patch filename computation in "git format-patch" format-patch: --numbered-files and --stdout aren't mutually exclusive format-patch: --attach/inline uses filename instead of SHA1 format-patch: move get_patch_filename() into log-tree format-patch: pass a commit to reopen_stdout() format-patch: construct patch filename in one function pretty.c: add %f format specifier to format_commit_message()
2009-04-06Add configuration variable for sign-off to format-patchLibravatar Heiko Voigt1-7/+16
If you regularly create patches which require a Signed-off: line you may want to make it your default to add that line. It also helps you not to forget to add the -s/--signoff switch. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27format-patch: add arbitrary email headersLibravatar Michael Hendricks1-0/+2
format-patch supports the format.headers configuration for adding arbitrary email headers to the patches it outputs. This patch adds support for an --add-header argument which makes the same feature available from the command line. This is useful when the content of custom email headers must change from branch to branch. This patch has been sponsored by Grant Street Group Signed-off-by: Michael Hendricks <michael@ndrix.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22format-patch: --attach/inline uses filename instead of SHA1Libravatar Stephen Boyd1-4/+4
Currently when format-patch is used with --attach or --inline the patch attachment has the SHA1 of the commit for its filename. This replaces the SHA1 with the filename used by format-patch when outputting to files. Fix tests relying on the SHA1 output and add a test showing how the --suffix option affects the attachment filename output. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22format-patch: move get_patch_filename() into log-treeLibravatar Stephen Boyd1-24/+0
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22format-patch: pass a commit to reopen_stdout()Libravatar Stephen Boyd1-28/+39
We use the commit to generate the patch filename in reopen_stdout() before we redirect stdout. The cover letter codepath creates a dummy commit with the desired subject line 'cover letter'. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22format-patch: construct patch filename in one functionLibravatar Stephen Boyd1-65/+33
reopen_stdout() usually takes the oneline subject of a commit, appends the patch suffix, prepends the output directory (if any) and then reopens stdout as the resulting file. Now the patch filename (the oneline subject and the patch suffix) is created in get_patch_filename() and passed to reopen_stdout() which prepends the output directory and reopens stdout as that file. The original function to get the oneline description, get_oneline_for_filename(), has been renamed to get_patch_filename() to reflect its new functionality. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-21Sync with maintLibravatar Junio C Hamano1-2/+0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-21format-patch: --numbered-files and --stdout aren't mutually exclusiveLibravatar Stephen Boyd1-2/+0
For example: git format-patch --numbered-files --stdout --attach HEAD~~ will create two messages with files 1 and 2 attached respectively. Without --attach/--inline but with --stdout, --numbered-files option can be simply ignored, because we are not creating any file ourselves. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-18format-patch: Respect --quiet optionLibravatar Nate Case1-4/+6
Hide the patch filename output from 'git format-patch' when --quiet is used. The man pages suggested that this should have already worked. Signed-off-by: Nate Case <ncase@xes-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-11Merge branch 'tr/format-patch-thread'Libravatar Junio C Hamano1-12/+54
* tr/format-patch-thread: format-patch: support deep threading format-patch: thread as reply to cover letter even with in-reply-to format-patch: track several references format-patch: threading test reactivation Conflicts: builtin-log.c
2009-02-21format-patch: support deep threadingLibravatar Thomas Rast1-4/+31
For deep threading mode, i.e., the mode that gives a thread structured like + [PATCH 0/n] Cover letter `-+ [PATCH 1/n] First patch `-+ [PATCH 2/n] Second patch `-+ ... we currently have to use 'git send-email --thread' (the default). On the other hand, format-patch also has a --thread option which gives shallow mode, i.e., + [PATCH 0/n] Cover letter |-+ [PATCH 1/n] First patch |-+ [PATCH 2/n] Second patch ... To reduce the confusion resulting from having two indentically named features in different tools giving different results, let format-patch take an optional argument '--thread=deep' that gives the same output as 'send-mail --thread'. With no argument, or 'shallow', behave as before. Also add a configuration variable format.thread with the same semantics. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-21format-patch: thread as reply to cover letter even with in-reply-toLibravatar Thomas Rast1-5/+15
Currently, format-patch --thread --cover-letter --in-reply-to $parent makes all mails, including the cover letter, a reply to $parent. However, we would want the reader to consider the cover letter above all the patches. This changes the semantics so that only the cover letter is a reply to $parent, while all the patches are formatted as replies to the cover letter. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-21format-patch: track several referencesLibravatar Thomas Rast1-4/+10
Currently, format-patch can only track a single reference (the In-Reply-To:) for each mail. To ensure proper threading, we should list all known references for every mail. Change the rev_info.ref_message_id field to a string_list, so that we can append references at will, and change the output formatting routines to print all of them in the References: header. The last entry in the list is implicitly assumed to be the In-Reply-To:, which gives output consistent with RFC 2822: The "References:" field will contain the contents of the parent's "References:" field (if any) followed by the contents of the parent's "Message-ID:" field (if any). Note that this is just preparatory work; nothing uses it yet, so all "References:" fields in the output are still only one deep. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-12Enable setting attach as the default in .gitconfig for git-format-patch.Libravatar Jeremy White1-0/+19
Signed-off-by: Jeremy White <jwhite@codeweavers.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-21Merge branch 'jc/maint-format-patch-o-relative'Libravatar Junio C Hamano1-3/+25
* jc/maint-format-patch-o-relative: Teach format-patch to handle output directory relative to cwd Conflicts: t/t4014-format-patch.sh
2009-01-17Merge branch 'jc/maint-format-patch'Libravatar Junio C Hamano1-0/+7
* jc/maint-format-patch: format-patch: show patch text for the root commit
2009-01-13Merge branch 'mh/cherry-default'Libravatar Junio C Hamano1-2/+14
* mh/cherry-default: Documentation: clarify which parameters are optional to git-cherry git-cherry: make <upstream> parameter optional
2009-01-12Teach format-patch to handle output directory relative to cwdLibravatar Junio C Hamano1-3/+25
Without any explicit -o parameter, we correctly avoided putting the resulting patch output to the toplevel. We should do the same when the user gave a relative pathname to be consistent with this case. Noticed by Cesar Eduardo Barros. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-10format-patch: show patch text for the root commitLibravatar Junio C Hamano1-0/+7
Even without --root specified, if the range given on the command line happens to include a root commit, we should include its patch text in the output. This fix deliberately ignores log.showroot configuration variable because "format-patch" and "log -p" can and should behave differently in this case, as the former is about exporting a part of your history in a form that is replayable elsewhere and just giving the commit log message without the patch text does not make any sense for that purpose. Noticed and fix originally attempted by Nathan W. Panike; credit goes to Alexander Potashev for injecting sanity to my initial (broken) fix that used the value from log.showroot configuration, which was misguided. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-05remove trailing LF in die() messagesLibravatar Alexander Potashev1-1/+1
LF at the end of format strings given to die() is redundant because die already adds one on its own. Signed-off-by: Alexander Potashev <aspotashev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-05Documentation: clarify which parameters are optional to git-cherryLibravatar Markus Heidelberg1-1/+1
An earlier parameter is only optional when all of the later parameters are omitted. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-05show <tag>: reuse pp_user_info() instead of duplicating codeLibravatar Johannes Schindelin1-15/+6
We used to extract the tagger information "by hand" in "git show <tag>", but the function pp_user_info() already does that. Even better: it respects the commit_format and date_format specified by the user. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-01git-cherry: make <upstream> parameter optionalLibravatar Markus Heidelberg1-2/+14
The upstream branch <upstream> now defaults to the first tracked remote branch, which is set by the configuration variables branch.<name>.remote and branch.<name>.merge of the current branch. Without such a remote branch, the command "git cherry [-v]" fails with usage output as before and an additional message. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-15Merge branch 'maint'Libravatar Junio C Hamano1-1/+7
* maint: fast-import: close pack before unlinking it pager: do not dup2 stderr if it is already redirected git-show: do not segfault when showing a bad tag
2008-12-15git-show: do not segfault when showing a bad tagLibravatar Junio C Hamano1-1/+7
When a tag points at a bad or nonexistent object, we should diagnose the breakage and exit. An earlier commit 4f3dcc2 (Fix 'git show' on signed tag of signed tag of commit, 2008-07-01) lost this check and made it segfault instead; not good. This fixes it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-07reorder ALLOW_TEXTCONV option settingLibravatar Jeff King1-1/+1
Right now for the diff porcelain and the log family, we call: init_revisions(); setup_revisions(); DIFF_OPT_SET(ALLOW_TEXTCONV); However, that means textconv will _always_ be on, instead of being a default that can be manipulated with setup_revisions. Instead, we want: init_revisions(); DIFF_OPT_SET(ALLOW_TEXTCONV); setup_revisions(); which is what this patch does. We'll go ahead and move the callsite in wt-status, also; even though the user can't pass any options here, it is a cleanup that will help avoid any surprise later if the setup_revisions line is changed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-12Merge branch 'lt/decorate'Libravatar Junio C Hamano1-2/+3
* lt/decorate: rev-list documentation: clarify the two parts of history simplification Document "git log --simplify-by-decoration" Document "git log --source" revision traversal: '--simplify-by-decoration' Make '--decorate' set an explicit 'show_decorations' flag revision: make tree comparison functions take commits rather than trees Add a 'source' decorator for commits Conflicts: Documentation/rev-list-options.txt
2008-11-04Make '--decorate' set an explicit 'show_decorations' flagLibravatar Linus Torvalds1-2/+1
We will want to add decorations without necessarily showing them, so add an explicit revisions info flag as to whether we're showing decorations or not. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-04Add a 'source' decorator for commitsLibravatar Linus Torvalds1-0/+2
We already support decorating commits by tags or branches that point to them, but especially when we are looking at multiple branches together, we sometimes want to see _how_ we reached a particular commit. We can abuse the '->util' field in the commit to keep track of that as we walk the commit lists, and get a reasonably useful view into which branch or tag first reaches that commit. Of course, if the commit is reachable through multiple sources (which is common), our particular choice of "first" reachable is entirely random and depends on the particular path we happened to follow. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-26userdiff: require explicitly allowing textconvLibravatar Jeff King1-0/+1
Diffs that have been produced with textconv almost certainly cannot be applied, so we want to be careful not to generate them in things like format-patch. This introduces a new diff options, ALLOW_TEXTCONV, which controls this behavior. It is off by default, but is explicitly turned on for the "log" family of commands, as well as the "diff" porcelain (but not diff-* plumbing). Because both text conversion and external diffing are controlled by these diff options, we can get rid of the "plumbing versus porcelain" distinction when reading the config. This was an attempt to control the same thing, but suffered from being too coarse-grained. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-18format-patch: autonumber by defaultLibravatar Brian Gernhardt1-1/+2
format-patch is most commonly used for multiple patches at once when sending a patchset, in which case we want to number the patches; on the other hand, single patches are not usually expected to be numbered. In other words, the typical behavior expected from format-patch is the one obtained by enabling autonumber, so we set it to be the default. Users that want to disable numbering for a particular patchset can do so with the existing -N command-line switch. Users that want to change the default behavior can use the format.numbering config key. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Test-updates-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-12Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerLibravatar Brandon Casey1-9/+4
Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>