summaryrefslogtreecommitdiff
path: root/revision.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-29Merge branch 'jc/notes-batch-removal'Libravatar Junio C Hamano1-2/+13
* jc/notes-batch-removal: show: --ignore-missing notes remove: --stdin reads from the standard input notes remove: --ignore-missing notes remove: allow removing more than one
2011-05-25Merge branch 'js/log-abbrev-commit-config'Libravatar Junio C Hamano1-0/+3
* js/log-abbrev-commit-config: Add log.abbrevCommit config variable "git log -h": typofix misspelled 'suppress'
2011-05-23Merge branch 'jc/magic-pathspec'Libravatar Junio C Hamano1-0/+14
* jc/magic-pathspec: setup.c: Fix some "symbol not declared" sparse warnings t3703: Skip tests using directory name ":" on Windows revision.c: leave a note for "a lone :" enhancement t3703, t4208: add test cases for magic pathspec rev/path disambiguation: further restrict "misspelled index entry" diag fix overslow :/no-such-string-ever-existed diagnostics fix overstrict :<path> diagnosis grep: use get_pathspec() correctly pathspec: drop "lone : means no pathspec" from get_pathspec() Revert "magic pathspec: add ":(icase)path" to match case insensitively" magic pathspec: add ":(icase)path" to match case insensitively magic pathspec: futureproof shorthand form magic pathspec: add tentative ":/path/from/top/level" pathspec support
2011-05-19Merge branch 'jc/maint-pathspec-stdin-and-cmdline'Libravatar Junio C Hamano1-52/+28
* jc/maint-pathspec-stdin-and-cmdline: setup_revisions(): take pathspec from command line and --stdin correctly Conflicts: revision.c
2011-05-19show: --ignore-missingLibravatar Junio C Hamano1-2/+13
Instead of barfing, simply ignore bad object names seen in the input. This is useful when reading from "git notes list" output that may refer to objects that have already been garbage collected. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-18Add log.abbrevCommit config variableLibravatar Jay Soffian1-0/+3
Add log.abbrevCommit config variable as a convenience for users who often use --abbrev-commit with git log and friends. Allow the option to be overridden with --no-abbrev-commit. Per 635530a2fc and 4f62c2bc57, the config variable is ignored when log is given "--pretty=raw". (Also, a drive-by spelling correction in git log's short help.) Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-13Merge branch 'jn/setup-revisions-glob-and-friends-passthru'Libravatar Junio C Hamano1-65/+72
* jn/setup-revisions-glob-and-friends-passthru: revisions: allow --glob and friends in parse_options-enabled commands revisions: split out handle_revision_pseudo_opt function
2011-05-11Merge branch 'jc/maint-1.7.4-pathspec-stdin-and-cmdline'Libravatar Junio C Hamano1-52/+28
Update the fix for 1.7.5 maintenance track. * jc/maint-1.7.4-pathspec-stdin-and-cmdline: setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11revision.c: leave a note for "a lone :" enhancementLibravatar Junio C Hamano1-0/+14
If we later add a command in the log family that by default limit its operation to the current subdirectory, we would need to resurrect the "a lone ':' on the command line means no pathspec whatsoever". Now the codepath was cleaned up, we can do so in one place. Leave a note to mark where it is for later generations. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-11Merge branch 'jc/maint-1.6.6-pathspec-stdin-and-cmdline'Libravatar Junio C Hamano1-52/+28
* jc/maint-1.6.6-pathspec-stdin-and-cmdline: setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11Merge branch 'jc/maint-1.6.6-pathspec-stdin-and-cmdline'Libravatar Junio C Hamano1-52/+28
Update the fix for 1.7.4 maintenance track. * jc/maint-1.6.6-pathspec-stdin-and-cmdline: setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-11setup_revisions(): take pathspec from command line and --stdin correctlyLibravatar Junio C Hamano1-52/+28
When the command line has "--" disambiguator, we take the remainder of argv[] as "prune_data", but when --stdin is given at the same time, we need to append to the existing prune_data and end up attempting to realloc(3) it. That would not work. Fix it by consistently using append_prune_data() throughout the input processing. Also avoid counting the number of existing paths in the function over and over again. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-21revisions: allow --glob and friends in parse_options-enabled commandsLibravatar Jonathan Nieder1-1/+13
As v1.6.0-rc2~42 (2008-07-31) explains, even pseudo-options like --not and --glob that need to be parsed in order with revisions should be marked handled by handle_revision_opt to avoid an error when parse_revision_opt callers like "git shortlog" encounter them. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-21revisions: split out handle_revision_pseudo_opt functionLibravatar Jonathan Nieder1-64/+59
As v1.6.0-rc2~42 (Allow "non-option" revision options in parse_option-enabled commands, 2008-07-31) explains, options handled by setup_revisions fall into two categories: 1. global options like --topo-order handled by parse_revision_opt, which can take detached arguments and can be parsed in advance; 2. pseudo-options that must be parsed in order with their revision counterparts, like --not and --all. The global options are taken care of by handle_revision_opt; the pseudo-options are currently in a deeply indented portion of setup_revisions. Give them their own function for easier reading. The only goal is to make setup_revisions easier to read straight through. No functional change intended. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-29revision.c: make --no-notes reset --notes listLibravatar Jeff King1-0/+6
With most command line options, later instances of an option override earlier ones. With cumulative options like "--notes", however, there is no way to say "forget the --notes I gave you before". Let's have --no-notes trigger this forgetting, so that: git log --notes=foo --no-notes --notes=bar will show only the "bar" notes. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-29revision.c: support --notes command-line optionLibravatar Jeff King1-5/+10
We already have --show-notes, but it has a few shortcomings: 1. Using --show-notes=<ref> implies that we should also show the default notes. Which means you also need to use --no-standard-notes if you want to suppress them. 2. It is negated by --no-notes, which doesn't match. 3. It's too long to type. :) This patch introduces --notes, which behaves exactly like --show-notes, except that using "--notes=<ref>" does not imply showing the default notes. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-29notes: refactor display notes default handlingLibravatar Jeff King1-2/+7
This is in preparation for more notes-related revision command-line options. The "suppress_default_notes" option is renamed to "use_default_notes", and is now a tri-state with values less than one indicating "not set". If the value is "not set", then we show default refs if and only if no other refs were given. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-29notes: refactor display notes extra refs fieldLibravatar Jeff King1-3/+1
There's no need to use an extra pointer, which just ends up leaking memory. The fact that the list is empty tells us the same thing. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-29revision.c: refactor notes ref expansionLibravatar Jeff King1-6/+1
No need to do it ourselves when there is a library function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-26Merge branch 'mg/rev-list-n-parents'Libravatar Junio C Hamano1-7/+21
* mg/rev-list-n-parents: tests: avoid nonportable {foo,bar} glob rev-list --min-parents,--max-parents: doc, test and completion revision.c: introduce --min-parents and --max-parents options t6009: use test_commit() from test-lib.sh
2011-03-23revision.c: introduce --min-parents and --max-parents optionsLibravatar Michael J Gruber1-7/+21
Introduce --min-parents and --max-parents options which limit the revisions to those commits which have at least (or at most) that many commits, where negative arguments for --max-parents= denote infinity (i.e. no upper limit). In particular: --max-parents=1 is the same as --no-merges; --min-parents=2 is the same as --merges; --max-parents=0 shows only roots; and --min-parents=3 shows only octopus merges Using --min-parents=n and --max-parents=m with n>m gives you what you ask for (i.e. nothing) for obvious reasons, just like when you give --merges (show only merge commits) and --no-merges (show only non-merge commits) at the same time. Also, introduce --no-min-parents and --no-max-parents to do the obvious thing for convenience. We compute the number of parents only when we limit by that, so there is no performance impact when there are no limiters. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-22Merge branch 'mg/rev-list-one-side-only'Libravatar Junio C Hamano1-3/+79
* mg/rev-list-one-side-only: git-log: put space after commit mark t6007: test rev-list --cherry log --cherry: a synonym rev-list: documentation and test for --cherry-mark revision.c: introduce --cherry-mark rev-list/log: factor out revision mark generation rev-list: --left/right-only are mutually exclusive rev-list: documentation and test for --left/right-only t6007: Make sure we test --cherry-pick revlist.c: introduce --left/right-only for unsymmetric picking
2011-03-10git-log: put space after commit markLibravatar Michael J Gruber1-0/+9
Currently, commit marks (left, right, boundary, cherry) are output right before the commit sha1, which makes it difficult to copy sha1s. Sample output for "git log --oneline --cherry": =049c269 t6007: test rev-list --cherry Change this to = 049c269 t6007: test rev-list --cherry which matches exactly the current output of "git log --graph". Leave "git rev-list" output as is (no space) so that they do not break. Adjust "git-svn" which uses "git log --pretty=raw --boundary". Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09log --cherry: a synonymLibravatar Michael J Gruber1-1/+9
At the porcelain level, because by definition there are many more contributors than integrators, it makes sense to give a handy short-hand for --right-only used with --cherry-mark and --no-merges. Make it so. In other words, this provides "git cherry with rev-list interface". Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09revision.c: introduce --cherry-markLibravatar Michael J Gruber1-3/+18
for marking those commits which "--cherry-pick" would drop. The marker for those commits is '=' because '-' denotes a boundary commit already, even though 'git cherry' uses it. Nonequivalent commits are denoted '+' unless '--left-right' is used. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09rev-list/log: factor out revision mark generationLibravatar Michael J Gruber1-0/+16
Currently, we have identical code for generating revision marks ('<', '>', '-') in 5 places. Factor out the code to a single function get_revision_mark() for easier maintenance and extensibility. Note that the check for !!revs in graph.c (which gets removed effectively by this patch) is superfluous. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21rev-list: --left/right-only are mutually exclusiveLibravatar Junio C Hamano1-0/+4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21revlist.c: introduce --left/right-only for unsymmetric pickingLibravatar Michael J Gruber1-0/+24
The existing "--cherry-pick" does not work with unsymmetric ranges (A..B) for obvious reasons. Introduce "--left-only" and "--right-only" which limit the output to commits on the respective sides of a symmetric range (i.e. only "<" resp. ">" commits as per "--left-right"). This is especially useful for things like git log --cherry-pick --right-only @{u}... which is much more flexible (and descriptive) than git cherry @{u} | sed -ne 's/^+ //p' and potentially more useful than git log --cherry-pick @{u}... Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-03Convert ce_path_match() to use struct pathspecLibravatar Nguyễn Thái Ngọc Duy1-1/+1
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-03struct rev_info: convert prune_data to struct pathspecLibravatar Nguyễn Thái Ngọc Duy1-7/+8
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-03Convert struct diff_options to use struct pathspecLibravatar Nguyễn Thái Ngọc Duy1-5/+1
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22Merge branch 'tf/commit-list-prefix'Libravatar Junio C Hamano1-6/+6
* tf/commit-list-prefix: commit: Add commit_list prefix in two function names. Conflicts: sha1_name.c
2010-12-12Merge branch 'jk/maint-reflog-bottom'Libravatar Junio C Hamano1-1/+3
* jk/maint-reflog-bottom: reflogs: clear flags properly in corner case
2010-11-29commit: Add commit_list prefix in two function names.Libravatar Thiago Farina1-6/+6
Add commit_list prefix to insert_by_date function and to sort_by_date, so it's clear that these functions refer to commit_list structure. Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-23reflogs: clear flags properly in corner caseLibravatar Jeff King1-1/+3
The reflog-walking mechanism is based on the regular revision traversal. We just rewrite the parents of each commit in fake_reflog_parent to point to the commit in the next reflog entry instead of the real parents. However, the regular revision traversal tries not to show the same commit twice, and so sets the SHOWN flag on each commit it shows. In a reflog, however, we may want to see the same commit more than once if it appears in the reflog multiple times (which easily happens, for example, if you do a reset to a prior state). The fake_reflog_parent function takes care of this by clearing flags, including SHOWN. Unfortunately, it does so at the very end of the function, and it is possible to return early from the function if there is no fake parent to set up (e.g., because we are at the very first reflog entry on the branch). In such a case the flag is not cleared, and the entry is skipped by the revision traversal machinery as already shown. You can see this by walking the log of a ref which is set to its very first commit more than once (the test below shows such a situation). In this case the reflog walk will fail to show the entry for the initial creation of the ref. We don't want to simply move the flag-clearing to the top of the function; we want to make sure flags set during the fake-parent installation are also cleared. Instead, let's hoist the flag-clearing out of the fake_reflog_parent function entirely. It's not really about fake parents anyway, and the only caller is the get_revision machinery. Reported-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-21Merge branch 'mm/shortopt-detached'Libravatar Junio C Hamano1-30/+51
* mm/shortopt-detached: log: parse separate option for --glob log: parse separate options like git log --grep foo diff: parse separate options --stat-width n, --stat-name-width n diff: split off a function for --stat-* option parsing diff: parse separate options like -S foo Conflicts: revision.c
2010-08-06log: parse separate option for --globLibravatar Matthieu Moy1-2/+5
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-06log: parse separate options like git log --grep fooLibravatar Matthieu Moy1-28/+46
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-07setup_revisions(): Allow walking history in a submoduleLibravatar Heiko Voigt1-14/+18
By passing the path to a submodule in opt->submodule, the function can be used to walk history in the named submodule repository, instead of the toplevel repository. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-30Merge branch 'jp/string-list-api-cleanup'Libravatar Junio C Hamano1-2/+2
* jp/string-list-api-cleanup: string_list: Fix argument order for string_list_append string_list: Fix argument order for string_list_lookup string_list: Fix argument order for string_list_insert_at_index string_list: Fix argument order for string_list_insert string_list: Fix argument order for for_each_string_list string_list: Fix argument order for print_string_list
2010-06-30Merge branch 'tr/rev-list-count'Libravatar Junio C Hamano1-0/+2
* tr/rev-list-count: bash completion: Support "divergence from upstream" messages in __git_ps1 rev-list: introduce --count option Conflicts: contrib/completion/git-completion.bash
2010-06-27Merge branch 'jn/show-num-walks'Libravatar Junio C Hamano1-0/+4
* jn/show-num-walks: DWIM 'git show -5' to 'git show --do-walk -5'
2010-06-27string_list: Fix argument order for string_list_appendLibravatar Julian Phillips1-2/+2
Update the definition and callers of string_list_append to use the string_list as the first argument. This helps make the string_list API easier to use by being more consistent. Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-22Merge branch 'jc/rev-list-ancestry-path'Libravatar Junio C Hamano1-0/+103
* jc/rev-list-ancestry-path: revision: Turn off history simplification in --ancestry-path mode revision: Fix typo in --ancestry-path error message Documentation/rev-list-options.txt: Explain --ancestry-path Documentation/rev-list-options.txt: Fix missing line in example history graph revision: --ancestry-path
2010-06-12rev-list: introduce --count optionLibravatar Thomas Rast1-0/+2
Add a --count option that, instead of actually listing the commits, merely counts them. This is mostly geared towards script use, and to this end it acts specially when used with --left-right: it outputs the left and right counts separately. Previously, scripts would have to run a shell loop or small inline script over to achieve the same. (Without --left-right, a simple |wc -l does the job.) Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-06revision: Turn off history simplification in --ancestry-path modeLibravatar Johan Herland1-0/+1
When using --ancestry-path together with history simplification (typically triggered by path limiting), history simplification would get in the way of --ancestry-path by prematurely removing the parent links between commits on which the ancestry path calculations are made. This patch disables this history simplification when --ancestry-path is enabled. This is similar to what e.g. --full-history already does. The patch also includes a simple testcase verifying that --ancestry-path works together with path limiting. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-06revision: Fix typo in --ancestry-path error messageLibravatar Johan Herland1-1/+1
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02DWIM 'git show -5' to 'git show --do-walk -5'Libravatar Jonathan Nieder1-0/+4
To show the last two commits with one command, one might try 1) git show -s master~2.. 2) git show -s ^master~2 master 3) git show -s master^ master 4) git show -s -2 master Choice (3) works because both commits are listed on the command line. Choices (1) and (2) have worked ever since v1.6.4-rc~3 (Make 'git show' more useful, 2009-07-13) disabled --no-walk in this case because there is no other useful meaning for them to have. Unfortunately, (4) does not work: it outputs only one commit, because --no-walk stays on. So disable --no-walk in this case so ‘git show’ and future ‘git cherry-pick’ can behave as expected. As a side effect, this unfortunately changes the meaning of ‘git log --oneline --decorate --no-walk -5 --all’: instead of listing five refs, after this patch that command would list the five most recent commits. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31enums: omit trailing comma for portabilityLibravatar Gary V. Vaughan1-1/+1
Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to compile git. enum style is inconsistent already, with some enums declared on one line, some over 3 lines with the enum values all on the middle line, sometimes with 1 enum value per line... and independently of that the trailing comma is sometimes present and other times absent, often mixing with/without trailing comma styles in a single file, and sometimes in consecutive enum declarations. Clearly, omitting the comma is the more portable style, and this patch changes all enum declarations to use the portable omitted dangling comma style consistently. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-21revision: --ancestry-pathLibravatar Junio C Hamano1-0/+102
"rev-list A..H" computes the set of commits that are ancestors of H, but excludes the ones that are ancestors of A. This is useful to see what happened to the history leading to H since A, in the sense that "what does H have that did not exist in A" (e.g. when you have a choice to update to H from A). x---x---A---B---C <-- topic / \ x---x---x---o---o---o---o---M---D---E---F---G <-- dev / \ x---o---o---o---o---o---o---o---o---o---o---o---N---H <-- master The result in the above example would be the commits marked with caps letters (except for A itself, of course), and the ones marked with 'o'. When you want to find out what commits in H are contaminated with the bug introduced by A and need fixing, however, you might want to view only the subset of "A..B" that are actually descendants of A, i.e. excluding the ones marked with 'o'. Introduce a new option --ancestry-path to compute this set with "rev-list --ancestry-path A..B". Note that in practice, you would build a fix immediately on top of A and "git branch --contains A" will give the names of branches that you would need to merge the fix into (i.e. topic, dev and master), so this may not be worth paying the extra cost of postprocessing. Signed-off-by: Junio C Hamano <gitster@pobox.com>