summaryrefslogtreecommitdiff
path: root/builtin-log.c
AgeCommit message (Collapse)AuthorFilesLines
2010-02-03Typofixes outside documentation areaLibravatar Junio C Hamano1-1/+1
begining -> beginning canonicalizations -> canonicalization comand -> command dewrapping -> unwrapping dirtyness -> dirtiness DISCLAMER -> DISCLAIMER explicitely -> explicitly feeded -> fed impiled -> implied madatory -> mandatory mimick -> mimic preceeding -> preceding reqeuest -> request substition -> substitution Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22Merge branch 'jc/maint-limit-note-output'Libravatar Junio C Hamano1-0/+3
* jc/maint-limit-note-output: Fix "log --oneline" not to show notes Fix "log" family not to be too agressive about showing notes
2010-01-20Fix "log" family not to be too agressive about showing notesLibravatar Junio C Hamano1-0/+3
Giving "Notes" information in the default output format of "log" and "show" is a sensible progress (the user has asked for it by having the notes), but for some commands (e.g. "format-patch") spewing notes into the formatted commit log message without being asked is too aggressive. Enable notes output only for "log", "show", "whatchanged" by default and only when the user didn't ask any specific --pretty/--format from the command line; users can explicitly override this default with --show-notes and --no-notes option. Parts of tests are taken from Jeff King's fix. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-26Merge branch 'jc/1.7.0-diff-whitespace-only-status'Libravatar Junio C Hamano1-1/+1
* jc/1.7.0-diff-whitespace-only-status: diff.c: fix typoes in comments Make test case number unique diff: Rename QUIET internal option to QUICK diff: change semantics of "ignore whitespace" options Conflicts: diff.h
2009-11-30Merge branch 'fc/maint-format-patch-pathspec-dashes'Libravatar Junio C Hamano1-1/+2
Conflicts: t/t4014-format-patch.sh
2009-11-26format-patch: fix parsing of "--" on the command lineLibravatar Felipe Contreras1-1/+2
When given a pathspec that does not match any path in the current work tree with an explicit "--": git format-patch <commit> -- <path> the command still complains that <path> does not exist in the current work tree and the user needs to explicitly specify "--" and errors out. This is because it incorrectly removes "--" from the command line arguments that is later passed to setup_revisions(). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-20Merge branch 'bg/format-patch-doc-update'Libravatar Junio C Hamano1-7/+17
* bg/format-patch-doc-update: format-patch: Add "--no-stat" as a synonym for "-p" format-patch documentation: Fix formatting format-patch documentation: Remove diff options that are not useful format-patch: Always generate a patch
2009-11-20Merge branch 'jn/help-everywhere'Libravatar Junio C Hamano1-0/+9
* jn/help-everywhere: (23 commits) diff --no-index: make the usage string less scary merge-{recursive,subtree}: use usagef() to print usage Introduce usagef() that takes a printf-style format Let 'git <command> -h' show usage without a git dir Show usage string for 'git http-push -h' Let 'git http-fetch -h' show usage outside any git repository Show usage string for 'git stripspace -h' Show usage string for 'git unpack-file -h' Show usage string for 'git show-index -h' Show usage string for 'git rev-parse -h' Show usage string for 'git merge-one-file -h' Show usage string for 'git mailsplit -h' Show usage string for 'git imap-send -h' Show usage string for 'git get-tar-commit-id -h' Show usage string for 'git fast-import -h' Show usage string for 'git check-ref-format -h' http-fetch: add missing initialization of argv0_path Show usage string for 'git show-ref -h' Show usage string for 'git merge-ours -h' Show usage string for 'git commit-tree -h' ... Conflicts: imap-send.c
2009-11-10Merge branch 'jk/maint-format-patch-p-suppress-stat'Libravatar Junio C Hamano1-2/+7
* jk/maint-format-patch-p-suppress-stat: format-patch: make "-p" suppress diffstat
2009-11-10Let 'git <command> -h' show usage without a git dirLibravatar Jonathan Nieder1-0/+6
There is no need for "git <command> -h" to depend on being inside a repository. Reported by Gerfried Fuchs through http://bugs.debian.org/462557 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10format-patch: Add "--no-stat" as a synonym for "-p"Libravatar Björn Gustavsson1-2/+3
"-p" means "generate patch" in 'git log' and 'git diff', so it's quite surprising that it means "suppress diffstat" in 'git format-patch'. Keep the "-p" option for backward compatibility, but add "--no-stat" as a more intuitive synonym. For backward compatibility with scripts, we must allow combinations of --stat and --no-stat. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10format-patch: Always generate a patchLibravatar Björn Gustavsson1-7/+16
Jeff King recently reinstated -p to suppress the default diffstat (as -p used to work before 68daa64, about 14 months ago). However, -p is also needed in combination with certain options (e.g. --stat or --numstat) in order to produce any patch at all. The documentation does not mention this. Since the purpose of format-patch is to produce a patch that can be emailed, it does not make sense that certain combination of options will suppress the generation of the patch itself. Therefore: * Update 'git format-patch' to always generate a patch. * Since the --name-only, --name-status, and --check suppresses the generation of the patch, disallow those options, and remove the description of them in the documentation. * Remove the reference to -p in the description of -U. * Remove the descriptions of the options that are synonyms for -p plus another option (--patch-with-raw and --patch-with-stat). * While at it, slightly tweak the description of -p itself to say that it generates "plain patches", so that you can think of -p as "plain patch" as an mnemonic aid. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-09Show usage string for 'git cherry -h'Libravatar Jonathan Nieder1-0/+3
Treat an "-h" option as a request for help, rather than an "Unknown commit -h" error. "cherry -h" could be asking to compare histories that leads to our HEAD and a commit that can be named as "-h". Strictly speaking, that may be a valid refname, but the user would have to say something like "tags/-h" to name such a pathological ref already, so it is not such a big deal. The "-h" option keeps its meaning even if preceded by other options or followed by other arguments. This keeps the command-line syntax closer to what parse_options would give and supports shell aliases like 'alias cherry="git cherry -v"' a little better. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-08format-patch: make "-p" suppress diffstatLibravatar Jeff King1-2/+7
Once upon a time, format-patch would use its default stat plus patch format only when no diff format was given on the command line. This meant that "format-patch -p" would suppress the stat and show just the patch. Commit 68daa64 changed this to keep the stat format when we had an "implicit" patch format, like "-U5". As a side effect, this meant that an explicit patch format was now ignored (because cmd_format_patch didn't know the reason that the format was set way down in diff_opt_parse). This patch unbreaks what 68daa64 did (while still preserving what 68daa64 was trying to do), reinstating "-p" to suppress the default behavior. We do this by parsing "-p" ourselves in format-patch, and noting whether it was used explicitly. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19Refactor pretty_print_commit arguments into a structLibravatar Thomas Rast1-1/+2
pretty_print_commit() has a bunch of rarely-used arguments, and introducing more of them requires yet another update of all the call sites. Refactor most of them into a struct to make future extensions easier. The ones that stay "plain" arguments were chosen on the grounds that all callers put real arguments there, whereas some callers have 0/NULL for all arguments that were factored into the struct. We declare the struct 'const' to ensure none of the callers are bitten by the changed (no longer call-by-value) semantics. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-29diff: Rename QUIET internal option to QUICKLibravatar Junio C Hamano1-1/+1
The option "QUIET" primarily meant "find if we have _any_ difference as quick as possible and report", which means we often do not even have to look at blobs if we know the trees are different by looking at the higher level (e.g. "diff-tree A B"). As a side effect, because there is no point showing one change that we happened to have found first, it also enables NO_OUTPUT and EXIT_WITH_STATUS options, making the end result look quiet. Rename the internal option to QUICK to reflect this better; it also makes grepping the source tree much easier, as there are other kinds of QUIET option everywhere. 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