1. 18 1月, 2009 1 次提交
    • J
      revision walker: include a detached HEAD in --all · f0298cf1
      Johannes Schindelin 提交于
      When HEAD is detached, --all should list it, too, logically, as a
      detached HEAD is by definition a temporary, unnamed branch.
      
      It is especially necessary to list it when garbage collecting, as
      the detached HEAD would be trashed.
      
      Noticed by Thomas Rast.
      
      Note that this affects creating bundles with --all; I contend that it
      is a good change to add the HEAD, so that cloning from such a bundle
      will give you a current branch.  However, I had to fix t5701 as it
      assumed that --all does not imply HEAD.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f0298cf1
  2. 15 11月, 2008 1 次提交
  3. 05 9月, 2008 1 次提交
    • J
      log --author/--committer: really match only with name part · a4d7d2c6
      Junio C Hamano 提交于
      When we tried to find commits done by AUTHOR, the first implementation
      tried to pattern match a line with "^author .*AUTHOR", which later was
      enhanced to strip leading caret and look for "^author AUTHOR" when the
      search pattern was anchored at the left end (i.e. --author="^AUTHOR").
      
      This had a few problems:
      
       * When looking for fixed strings (e.g. "git log -F --author=x --grep=y"),
         the regexp internally used "^author .*x" would never match anything;
      
       * To match at the end (e.g. "git log --author='google.com>$'"), the
         generated regexp has to also match the trailing timestamp part the
         commit header lines have.  Also, in order to determine if the '$' at
         the end means "match at the end of the line" or just a literal dollar
         sign (probably backslash-quoted), we would need to parse the regexp
         ourselves.
      
      An earlier alternative tried to make sure that a line matches "^author "
      (to limit by field name) and the user supplied pattern at the same time.
      While it solved the -F problem by introducing a special override for
      matching the "^author ", it did not solve the trailing timestamp nor tail
      match problem.  It also would have matched every commit if --author=author
      was asked for, not because the author's email part had this string, but
      because every commit header line that talks about the author begins with
      that field name, regardleses of who wrote it.
      
      Instead of piling more hacks on top of hacks, this rethinks the grep
      machinery that is used to look for strings in the commit header, and makes
      sure that (1) field name matches literally at the beginning of the line,
      followed by a SP, and (2) the user supplied pattern is matched against the
      remainder of the line, excluding the trailing timestamp data.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a4d7d2c6
  4. 25 8月, 2008 1 次提交
    • J
      Fix "git log -i --grep" · 0843acfd
      Jeff King 提交于
      This has been broken in v1.6.0 due to the reorganization of
      the revision option parsing code. The "-i" is completely
      ignored, but works fine in "git log --grep -i".
      
      What happens is that the code for "-i" looks for
      revs->grep_filter; if it is NULL, we do nothing, since there
      are no grep filters. But that is obviously not correct,
      since we want it to influence the later --grep option. Doing
      it the other way around works, since "-i" just impacts the
      existing grep_filter option.
      
      Instead, we now always initialize the grep_filter member and
      just fill in options and patterns as we get them. This means
      that we can no longer check grep_filter for NULL, but
      instead must check the pattern list to see if we have any
      actual patterns.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0843acfd
  5. 01 8月, 2008 1 次提交
    • P
      Allow "non-option" revision options in parse_option-enabled commands · 0fe8c138
      Pierre Habouzit 提交于
      Commands which use parse_options() but also call setup_revisions()
      must do their parsing in a two step process:
      
        1. first, they parse all options. Anything unknown goes to
           parse_revision_opt() (which calls handle_revision_opt), which
           may claim the option or say "I don't recognize this"
      
        2. the non-option remainder goes to setup_revisions() to
           actually get turned into revisions
      
      Some revision options are "non-options" in that they must be
      parsed in order with their revision counterparts in
      setup_revisions().  For example, "--all" functions as a
      pseudo-option expanding to all refs, and "--no-walk" affects refs
      after it on the command line, but not before. The revision option
      parser in step 1 recognizes such options and sets them aside for
      later parsing by setup_revisions().
      
      However, the return value used from handle_revision_opt indicated
      "I didn't recognize this", which was wrong. It did, and it took
      appropriate action (even though that action was just deferring it
      for later parsing). Thus it should return "yes, I recognized
      this."
      
      Previously, these pseudo-options generated an error when used with
      parse_options parsers (currently just blame and shortlog). With
      this patch, they should work fine, enabling things like "git
      shortlog --all".
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-By: NPierre Habouzit <madcoder@debian.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0fe8c138
  6. 17 7月, 2008 1 次提交
  7. 14 7月, 2008 1 次提交
  8. 10 7月, 2008 1 次提交
  9. 09 7月, 2008 1 次提交
  10. 06 7月, 2008 1 次提交
  11. 26 5月, 2008 5 次提交
  12. 13 5月, 2008 1 次提交
  13. 06 5月, 2008 2 次提交
  14. 30 4月, 2008 1 次提交
    • S
      Simplify and fix --first-parent implementation · d9c292e8
      Stephen R. van den Berg 提交于
      The purpose of --first-parent is to view the tree without looking at
      side branche.  This is accomplished by pretending there are no other
      parents than the first parent when encountering a merge.
      
      The current code marks the other parents as seen, which means that the tree
      traversal will behave differently depending on the order merges are handled.
      
      When a fast forward is artificially recorded as a merge,
      
             -----
            /     \
       D---E---F---G master
      
      the current first-parent code considers E to be seen and stops the
      traversal after showing G and F.
      Signed-off-by: NStephen R. van den Berg <srb@cuci.nl>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d9c292e8
  15. 13 4月, 2008 1 次提交
  16. 12 4月, 2008 1 次提交
  17. 10 4月, 2008 1 次提交
    • J
      log: teach "terminator" vs "separator" mode to "--pretty=format" · 4da45bef
      Junio C Hamano 提交于
      This attached patch introduces a single bit "use_terminator" in "struct
      rev_info", which is normally false (i.e. most formats use separator
      semantics) but by flipping it to true, you can ask for terminator
      semantics just like oneline format does.
      
      The function get_commit_format(), which is what parses "--pretty=" option,
      now takes a pointer to "struct rev_info" and updates its commit_format and
      use_terminator fields.  It used to return the value of type "enum
      cmit_fmt", but all the callers assigned it to rev->commit_format.
      
      There are only two cases the code turns use_terminator on.  Obviously, the
      traditional oneline format (--pretty=oneline) is one of them, and the new
      case is --pretty=tformat:... that acts like --pretty=format:... but flips
      the bit on.
      
      With this, "--pretty=tformat:%H %s" acts like --pretty=oneline.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4da45bef
  18. 19 3月, 2008 1 次提交
    • L
      Make revision limiting more robust against occasional bad commit dates · 7d004199
      Linus Torvalds 提交于
      The revision limiter uses the commit date to decide when it has seen
      enough commits to finalize the revision list, but that can get confused
      if there are incorrect dates far in the past on some commits.
      
      This makes the logic a bit more robust by
      
       - we always walk an extra SLOP commits from the source list even if we
         decide that the source list is probably all done (unless the source is
         entirely empty, of course, because then we really can't do anything at
         all)
      
       - we keep track of the date of the last commit we added to the
         destination list (this will *generally* be the oldest entry we've seen
         so far)
      
       - we compare that with the youngest entry (the first one) of the source
         list, and if the destination is older than the source, we know we want
         to look at the source.
      
      which causes occasional date mishaps to be handled cleanly.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7d004199
  19. 29 2月, 2008 1 次提交
  20. 28 2月, 2008 1 次提交
  21. 27 2月, 2008 1 次提交
  22. 19 2月, 2008 2 次提交
  23. 14 2月, 2008 3 次提交
    • L
      Add "--show-all" revision walker flag for debugging · 3131b713
      Linus Torvalds 提交于
      It's really not very easy to visualize the commit walker, because - on
      purpose - it obvously doesn't show the uninteresting commits!
      
      This adds a "--show-all" flag to the revision walker, which will make
      it show uninteresting commits too, and they'll have a '^' in front of
      them (it also fixes a logic error for !verbose_header for boundary
      commits - we should show the '-' even if left_right isn't shown).
      
      A separate patch to gitk to teach it the new '^' was sent
      to paulus.  With the change in place, it actually is interesting
      even for the cases that git doesn't have any problems with, ie
      for the kernel you can do:
      
      	gitk -d --show-all v2.6.24..
      
      and you see just how far down it has to parse things to see it all. The
      use of "-d" is a good idea, since the date-ordered toposort is much better
      at showing why it goes deep down (ie the date of some of those commits
      after 2.6.24 is much older, because they were merged from trees that
      weren't rebased).
      
      So I think this is a useful feature even for non-debugging - just to
      visualize what git does internally more.
      
      When it actually breaks out due to the "everybody_uninteresting()"
      case, it adds the uninteresting commits (both the one it's looking at
      now, and the list of pending ones) to the list
      
      This way, we really list *all* the commits we've looked at.
      
      Because we now end up listing commits we may not even have been parsed
      at all "show_log" and "show_commit" need to protect against commits
      that don't have a commit buffer entry.
      
      That second part is debatable just how it should work. Maybe we shouldn't
      show such entries at all (with this patch those entries do get shown, they
      just don't get any message shown with them). But I think this is a useful
      case.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3131b713
    • J
      diff --relative: help working in a bare repository · c0cb4a06
      Junio C Hamano 提交于
      This allows the --relative option to say which subdirectory to
      pretend to be in, so that in a bare repository, you can say:
      
          $ git log --relative=drivers/ v2.6.20..v2.6.22 -- drivers/scsi/
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c0cb4a06
    • J
      diff --relative: output paths as relative to the current subdirectory · cd676a51
      Junio C Hamano 提交于
      This adds --relative option to the diff family.  When you start
      from a subdirectory:
      
              $ git diff --relative
      
      shows only the diff that is inside your current subdirectory,
      and without $prefix part.  People who usually live in
      subdirectories may like it.
      
      There are a few things I should also mention about the change:
      
       - This works not just with diff but also works with the log
         family of commands, but the history pruning is not affected.
      
         In other words, if you go to a subdirectory, you can say:
      
              $ git log --relative -p
      
         but it will show the log message even for commits that do not
         touch the current directory.  You can limit it by giving
         pathspec yourself:
      
              $ git log --relative -p .
      
         This originally was not a conscious design choice, but we
         have a way to affect diff pathspec and pruning pathspec
         independently.  IOW "git log --full-diff -p ." tells it to
         prune history to commits that affect the current subdirectory
         but show the changes with full context.  I think it makes
         more sense to leave pruning independent from --relative than
         the obvious alternative of always pruning with the current
         subdirectory, which would break the symmetry.
      
       - Because this works also with the log family, you could
         format-patch a single change, limiting the effect to your
         subdirectory, like so:
      
              $ cd gitk-git
              $ git format-patch -1 --relative 911f1eb
      
         But because that is a special purpose usage, this option will
         never become the default, with or without repository or user
         preference configuration.  The risk of producing a partial
         patch and sending it out by mistake is too great if we did
         so.
      
       - This is inherently incompatible with --no-index, which is a
         bolted-on hack that does not have much to do with git
         itself.  I didn't bother checking and erroring out on the
         combined use of the options, but probably I should.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cd676a51
  24. 27 12月, 2007 1 次提交
  25. 12 12月, 2007 1 次提交
    • J
      shortlog: default to HEAD when the standard input is a tty · 3384a2df
      Junio C Hamano 提交于
      Instead of warning the user that it is expecting git log output from
      the standard input (and waiting for the user to type the log from
      the keyboard, which is a silly thing to do), default to traverse from
      HEAD when there is no rev parameter given and the standard input is
      a tty.
      
      This factors out a useful helper "add_head()" from builtin-diff.c to a
      more appropriate place revision.c while renaming it to more descriptive
      name add_head_to_pending(), as that is what the function is about.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3384a2df
  26. 17 11月, 2007 1 次提交
    • L
      Fix rev-list when showing objects involving submodules · 481f0ee6
      Linus Torvalds 提交于
      The function mark_tree_uninteresting() assumed that the tree entries
      are blob when they are not trees.  This is not so.  Since we do
      not traverse into submodules (yet), the gitlinks should be ignored.
      
      In general, we should try to start moving away from using the
      "S_ISLNK()" like things for internal git state. It was a mistake to
      just assume the numbers all were same across all systems in the first
      place.  This implementation converts to the "object_type", and then
      uses a case statement.
      
      Noticed by Ilari on IRC.
      Test script taken from an earlier version by Dscho.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      481f0ee6
  27. 14 11月, 2007 2 次提交
    • L
      Fix parent rewriting in --early-output · 7dc0fe3b
      Linus Torvalds 提交于
      We cannot tell a node that has been checked and found not to be
      interesting (which does not have the TREECHANGE flag) from a
      node that hasn't been checked if it is interesting or not,
      without relying on something else, such as object->parsed.
      
      But an object can get the "parsed" flag for other reasons.
      Which means that "TREECHANGE" has the wrong polarity.
      
      This changes the way how the path pruning logic marks an
      uninteresting commits.  From now on, we consider a commit
      interesting by default, and explicitly mark the ones we decided
      to prune.  The flag is renamed to "TREESAME".
      
      Then, this fixes the logic to show the early output with
      incomplete pruning.  It basically says "a commit that has
      TREESAME set is kind-of-UNINTERESTING", but obviously in a
      different way than an outright UNINTERESTING commit.  Until we
      parse and examine enough parents to determine if a commit
      becomes surely "kind-of-UNINTERESTING", we avoid rewriting
      the ancestry so that later rounds can fix things up.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7dc0fe3b
    • L
      Fix rev-list when showing objects involving submodules · 4d1012c3
      Linus Torvalds 提交于
      The function mark_tree_uninteresting() assumed that the tree entries
      are blob when they are not trees.  This is not so.  Since we do
      not traverse into submodules (yet), the gitlinks should be ignored.
      
      In general, we should try to start moving away from using the
      "S_ISLNK()" like things for internal git state. It was a mistake to
      just assume the numbers all were same across all systems in the first
      place.  This implementation converts to the "object_type", and then
      uses a case statement.
      
      Noticed by Ilari on IRC.
      Test script taken from an earlier version by Dscho.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4d1012c3
  28. 12 11月, 2007 1 次提交
  29. 06 11月, 2007 2 次提交
    • L
      revision walker: mini clean-up · 53b2c823
      Linus Torvalds 提交于
      This removes the unnecessary indirection of "revs->prune_fn",
      since that function is always the same one (or NULL), and there
      is in fact not even an abstraction reason to make it a function
      (i.e. its not called from some other file and doesn't allow us
      to keep the function itself static or anything like that).
      
      It then just replaces it with a bit that says "prune or not",
      and if not pruning, every commit gets TREECHANGE.
      
      That in turn means that
      
       - if (!revs->prune_fn || (flags & TREECHANGE))
       - if (revs->prune_fn && !(flags & TREECHANGE))
      
      just become
      
       - if (flags & TREECHANGE)
       - if (!(flags & TREECHANGE))
      
      respectively.
      
      Together with adding the "single_parent()" helper function, the "complex"
      conditional now becomes
      
      	if (!(flags & TREECHANGE) && rev->dense && single_parent(commit))
      		continue;
      
      Also indirection of "revs->dense" checking is thrown away the
      same way, because TREECHANGE bit is set appropriately now.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      53b2c823
    • L
      Enhance --early-output format · 252a7c02
      Linus Torvalds 提交于
      This makes --early-output a bit more advanced, and actually makes it
      generate multiple "Final output:" headers as it updates things
      asynchronously. I realize that the "Final output:" line is now illogical,
      since it's not really final until it also says "done", but
      
      It now _always_ generates a "Final output:" header in front of any commit
      list, and that output header gives you a *guess* at the maximum number of
      commits available. However, it should be noted that the guess can be
      completely off: I do a reasonable job estimating it, but it is not meant
      to be exact.
      
      So what happens is that you may get output like this:
      
       - at 0.1 seconds:
      
      	Final output: 2 incomplete
      	.. 2 commits listed ..
      
       - half a second later:
      
      	Final output: 33 incomplete
      	.. 33 commits listed ..
      
       - another half a second after that:
      
      	Final output: 71 incomplete
      	.. 71 commits listed ..
      
       - another half second later:
      
      	Final output: 136 incomplete
      	.. 100 commits listed: we hit the --early-output limit, and
      	.. will only output 100 commits, and after this you'll not
      	.. see an "incomplete" report any more since you got as much
      	.. early output as you asked for!
      
       - .. and then finally:
      
      	Final output: 73106 done
      	.. all the commits ..
      
      The above is a real-life scenario on my current kernel tree after having
      flushed all the caches.
      
      Tested with the experimental gitk patch that Paul sent out, and by looking
      at the actual log output (and verifying that my commit count guesses
      actually match real life fairly well).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      252a7c02
  30. 04 11月, 2007 1 次提交
    • L
      Add "--early-output" log flag for interactive GUI use · cdcefbc9
      Linus Torvalds 提交于
      This adds support for "--early-output[=n]" as a flag to the "git log"
      family of commands.  This allows GUI programs to state that they want to
      get some output early, in order to be able to show at least something
      quickly, even if the full output may take longer to generate.
      
      If no count is specified, a default count of a hundred commits will be
      used, although the actual numbr of commits output may be smaller
      depending on how many commits were actually found in the first tenth of
      a second (or if *everything* was found before that, in which case no
      early output will be provided, and only the final list is made
      available).
      
      When the full list is generated, there will be a "Final output:" string
      prepended to it, regardless of whether any early commits were shown or
      not, so that the consumer can always know the difference between early
      output and the final list.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cdcefbc9