summaryrefslogtreecommitdiff
path: root/builtin-log.c
AgeCommit message (Collapse)Author
2009-06-21Fix various sparse warnings in the git source codeLinus Torvalds
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'Junio C Hamano
* 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'Junio C Hamano
* sb/format-patch-parseopt: format-patch: migrate to parse-options API Conflicts: builtin-log.c
2009-05-31t9139 uses ancient, backwards-compatible iconv namesEric Wong
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_FILENAMEStephen Boyd
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-filenameJunio C Hamano
* sb/format-patch-parseopt: format-patch: migrate to parse-options API Conflicts: builtin-log.c
2009-05-19Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibilityBrandon Casey
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-18format-patch: migrate to parse-options APIStephen Boyd
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.numberedJim Meyering
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'Junio C Hamano
* 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-patchHeiko Voigt
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-28format-patch: add arbitrary email headersMichael Hendricks
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-23format-patch: --attach/inline uses filename instead of SHA1Stephen Boyd
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-23format-patch: move get_patch_filename() into log-treeStephen Boyd
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-23format-patch: pass a commit to reopen_stdout()Stephen Boyd
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-23format-patch: construct patch filename in one functionStephen Boyd
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-22Sync with maintJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22format-patch: --numbered-files and --stdout aren't mutually exclusiveStephen Boyd
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-19format-patch: Respect --quiet optionNate Case
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'Junio C Hamano
* 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-22format-patch: support deep threadingThomas Rast
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-22format-patch: thread as reply to cover letter even with in-reply-toThomas Rast
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-22format-patch: track several referencesThomas Rast
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.Jeremy White
Signed-off-by: Jeremy White <jwhite@codeweavers.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-22Merge branch 'jc/maint-format-patch-o-relative'Junio C Hamano
* jc/maint-format-patch-o-relative: Teach format-patch to handle output directory relative to cwd Conflicts: t/t4014-format-patch.sh
2009-01-18Merge branch 'jc/maint-format-patch'Junio C Hamano
* jc/maint-format-patch: format-patch: show patch text for the root commit
2009-01-14Merge branch 'mh/cherry-default'Junio C Hamano
* mh/cherry-default: Documentation: clarify which parameters are optional to git-cherry git-cherry: make <upstream> parameter optional
2009-01-13Teach format-patch to handle output directory relative to cwdJunio C Hamano
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-11format-patch: show patch text for the root commitJunio C Hamano
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() messagesAlexander Potashev
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-cherryMarkus Heidelberg
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 codeJohannes Schindelin
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 optionalMarkus Heidelberg
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-16Merge branch 'maint'Junio C Hamano
* 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 tagJunio C Hamano
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-08reorder ALLOW_TEXTCONV option settingJeff King
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-13Merge branch 'lt/decorate'Junio C Hamano
* 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' flagLinus Torvalds
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 commitsLinus Torvalds
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 textconvJeff King
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 defaultBrian Gernhardt
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 initializerBrandon Casey
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>
2008-09-20Merge branch 'maint'Junio C Hamano
* maint: Start draft release notes for 1.6.0.3 git-repack uses --no-repack-object, not --no-repack-delta. Typo "bogos" in format-patch error message. builtin-clone: fix typo Bust the ghost of long-defunct diffcore-pathspec. completion: git commit should list --interactive Conflicts: RelNotes
2008-09-20Typo "bogos" in format-patch error message.Mikael Magnusson
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-05move load_ref_decorations() to log-tree.c and export itRené Scharfe
log-tree.c is the ideal place for load_ref_decorations() and its helper functions to live in, because the variable name_decoration they're operating on is already located there, so move them thither. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-05log: add load_ref_decorations()René Scharfe
Move the loading of all ref names for decoration into its own function. A static variable prevents loading twice, because it's quite expensive. We can do it this way because we currently never unload decorations. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27format-patch: use default diff format even with patch optionsJeff King
Previously, running "git format-patch -U5" would cause the low-level diff machinery to change the diff output format from "not specified" to "patch". This meant that format-patch thought we explicitly specified a diff output format, and would not use the default format. The resulting message lacked both the diffstat and the summary, as well as the separating "---". Now format-patch explicitly checks for this condition and uses the default. That means that "git format-patch -p" will now have the "-p" ignored. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-21Merge branch 'pm/log-exit-code'Junio C Hamano
* pm/log-exit-code: Teach git log --exit-code to return an appropriate exit code Teach git log --check to return an appropriate exit code
2008-08-20git format-patch: avoid underrun when format.headers is empty or all NLsJim Meyering
* builtin-log.c (add_header): Avoid a buffer underrun when format.headers is empty or all newlines. Reproduce with this: git config format.headers '' && git format-patch -1 Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-17Teach git log --exit-code to return an appropriate exit codePeter Valdemar Mørch
Signed-off-by: Peter Valdemar Mørch <peter@morch.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>