1. 13 4月, 2009 2 次提交
    • L
      show_object(): push path_name() call further down · cf2ab916
      Linus Torvalds 提交于
      In particular, pushing the "path_name()" call _into_ the show() function
      would seem to allow
      
       - more clarity into who "owns" the name (ie now when we free the name in
         the show_object callback, it's because we generated it ourselves by
         calling path_name())
      
       - not calling path_name() at all, either because we don't care about the
         name in the first place, or because we are actually happy walking the
         linked list of "struct name_path *" and the last component.
      
      Now, I didn't do that latter optimization, because it would require some
      more coding, but especially looking at "builtin-pack-objects.c", we really
      don't even want the whole pathname, we really would be better off with the
      list of path components.
      
      Why? We use that name for two things:
       - add_preferred_base_object(), which actually _wants_ to traverse the
         path, and now does it by looking for '/' characters!
       - for 'name_hash()', which only cares about the last 16 characters of a
         name, so again, generating the full name seems to be just unnecessary
         work.
      
      Anyway, so I didn't look any closer at those things, but it did convince
      me that the "show_object()" calling convention was crazy, and we're
      actually better off doing _less_ in list-objects.c, and giving people
      access to the internal data structures so that they can decide whether
      they want to generate a path-name or not.
      
      This patch does that, and then for people who did use the name (even if
      they might do something more clever in the future), it just does the
      straightforward "name = path_name(path, component); .. free(name);" thing.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cf2ab916
    • L
      process_{tree,blob}: show objects without buffering · 8d2dfc49
      Linus Torvalds 提交于
      Here's a less trivial thing, and slightly more dubious one.
      
      I was looking at that "struct object_array objects", and wondering why we
      do that. I have honestly totally forgotten. Why not just call the "show()"
      function as we encounter the objects? Rather than add the objects to the
      object_array, and then at the very end going through the array and doing a
      'show' on all, just do things more incrementally.
      
      Now, there are possible downsides to this:
      
       - the "buffer using object_array" _can_ in theory result in at least
         better I-cache usage (two tight loops rather than one more spread out
         one). I don't think this is a real issue, but in theory..
      
       - this _does_ change the order of the objects printed. Instead of doing a
         "process_tree(revs, commit->tree, &objects, NULL, "");" in the loop
         over the commits (which puts all the root trees _first_ in the object
         list, this patch just adds them to the list of pending objects, and
         then we'll traverse them in that order (and thus show each root tree
         object together with the objects we discover under it)
      
         I _think_ the new ordering actually makes more sense, but the object
         ordering is actually a subtle thing when it comes to packing
         efficiency, so any change in order is going to have implications for
         packing. Good or bad, I dunno.
      
       - There may be some reason why we did it that odd way with the object
         array, that I have simply forgotten.
      
      Anyway, now that we don't buffer up the objects before showing them
      that may actually result in lower memory usage during that whole
      traverse_commit_list() phase.
      
      This is seriously not very deeply tested. It makes sense to me, it seems
      to pass all the tests, it looks ok, but...
      
      Does anybody remember why we did that "object_array" thing? It used to be
      an "object_list" a long long time ago, but got changed into the array due
      to better memory usage patterns (those linked lists of obejcts are
      horrible from a memory allocation standpoint). But I wonder why we didn't
      do this back then. Maybe there's a reason for it.
      
      Or maybe there _used_ to be a reason, and no longer is.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8d2dfc49
  2. 23 3月, 2009 1 次提交
  3. 21 3月, 2009 1 次提交
  4. 28 2月, 2009 4 次提交
    • J
      is_kept_pack(): final clean-up · 69e020ae
      Junio C Hamano 提交于
      Now is_kept_pack() is just a member lookup into a structure, we can write
      it as such.
      
      Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
      criteria the callee uses (namely, revs->kept_pack_only) between calling
      has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
      have to take a pointer to struct rev_info as an argument.
      
      This removes the header file dependency issue temporarily introduced by
      the earlier commit, so we revert changes associated to that as well.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      69e020ae
    • J
      Simplify is_kept_pack() · 03a9683d
      Junio C Hamano 提交于
      This removes --unpacked=<packfile> parameter from the revision parser, and
      rewrites its use in git-repack to pass a single --kept-pack-only option
      instead.
      
      The new --kept-pack-only option means just that.  When this option is
      given, is_kept_pack() that used to say "not on the --unpacked=<packfile>
      list" now says "the packfile has corresponding .keep file".
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      03a9683d
    • J
      Consolidate ignore_packed logic more · 386cb772
      Junio C Hamano 提交于
      This refactors three loops that check if a given packfile is on the
      ignore_packed list into a function is_kept_pack().  The function returns
      false for a pack on the list, and true for a pack not on the list, because
      this list is solely used by "git repack" to pass list of packfiles that do
      not have corresponding .keep files, i.e. a packfile not on the list is
      "kept".
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      386cb772
    • J
      has_sha1_kept_pack(): take "struct rev_info" · b8431b03
      Junio C Hamano 提交于
      Its "ignore_packed" parameter always comes from struct rev_info.  This
      patch makes the function take a pointer to the surrounding structure, so
      that the refactoring in the next patch becomes easier to review.
      
      There is an unfortunate header file dependency and the easiest workaround
      is to temporarily move the function declaration from cache.h to
      revision.h; this will be moved back to cache.h once the function loses
      this "ignore_packed" parameter altogether in the later part of the
      series.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b8431b03
  5. 22 2月, 2009 1 次提交
    • T
      format-patch: track several references · b079c50e
      Thomas 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: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b079c50e
  6. 04 11月, 2008 3 次提交
  7. 30 8月, 2008 1 次提交
    • T
      rev-list: fix --reverse interaction with --parents · 498bcd31
      Thomas Rast 提交于
      --reverse did not interact well with --parents, as the included test
      case shows: in a history like
      
        A--B.
         \   \
          `C--M--D
      
      the command
      
        git rev-list --reverse --parents --full-history HEAD
      
      erroneously lists D as having no parents at all.  (Without --reverse,
      it correctly lists M.)
      
      This is caused by the machinery driving --reverse: it first grabs all
      commits through the normal routines, then runs them through the same
      routines again, effectively simplifying them twice.
      
      Fix this by moving the --reverse one level up, into get_revision().
      This way we can cleanly grab all commits via the normal calls, then
      just pop them off the list one by one without interfering with
      get_revision_internal().
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      498bcd31
  8. 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
  9. 21 8月, 2008 1 次提交
  10. 15 8月, 2008 1 次提交
  11. 02 8月, 2008 2 次提交
    • J
      revision traversal: show full history with merge simplification · 6546b593
      Junio C Hamano 提交于
      The --full-history traversal keeps all merges in addition to non-merge
      commits that touch paths in the given pathspec.  This is useful to view
      both sides of a merge in a topology like this:
      
              A---M---o
             /   /
         ---O---B
      
      even when A and B makes identical change to the given paths.  The revision
      traversal without --full-history aims to come up with the simplest history
      to explain the final state of the tree, and one of the side branches can
      be pruned away.
      
      The behaviour to keep all merges however is inconvenient if neither A nor
      B touches the paths we are interested in.  --full-history reduces the
      topology to:
      
         ---O---M---o
      
      in such a case, without removing M.
      
      This adds a post processing phase on top of --full-history traversal to
      remove needless merges from the resulting history.
      
      The idea is to compute, for each commit in the "full history" result set,
      the commit that should replace it in the simplified history.  The commit
      to replace it in the final history is determined as follows:
      
       * In any case, we first figure out the replacement commits of parents of
         the commit we are looking at.  The commit we are looking at is
         rewritten as if the replacement commits of its original parents are its
         parents.  While doing so, we reduce the redundant parents from the
         rewritten parent list by not just removing the identical ones, but also
         removing a parent that is an ancestor of another parent.
      
       * After the above parent simplification, if the commit is a root commit,
         an UNINTERESTING commit, a merge commit, or modifies the paths we are
         interested in, then the replacement commit of the commit is itself.  In
         other words, such a commit is not dropped from the final result.
      
      The first point above essentially means that the history is rewritten in
      the bottom up direction.  We can rewrite the parent list of a commit only
      after we know how all of its parents are rewritten.  This means that the
      processing needs to happen on the full history (i.e. after limit_list()).
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6546b593
    • J
      sort_in_topological_order(): avoid setting a commit flag · 11ee57bc
      Johannes Schindelin 提交于
      We used to set the TOPOSORT flag of commits during the topological
      sorting, but we can just as well use the member "indegree" for it:
      indegree is now incremented by 1 in the cases where the commit used
      to have the TOPOSORT flag.
      
      This is the same behavior as before, since indegree could not be
      non-zero when TOPOSORT was unset.
      
      Incidentally, this fixes the bug in show-branch where the 8th column
      was not shown: show-branch sorts the commits in topological order,
      assuming that all the commit flags are available for show-branch's
      private matters.
      
      But this was not true: TOPOSORT was identical to the flag corresponding
      to the 8th ref.  So the flags for the 8th column were unset by the
      topological sorting.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      11ee57bc
  12. 24 7月, 2008 1 次提交
    • J
      sort_in_topological_order(): avoid setting a commit flag · e358f3c3
      Johannes Schindelin 提交于
      We used to set the TOPOSORT flag of commits during the topological
      sorting, but we can just as well use the member "indegree" for it:
      indegree is now incremented by 1 in the cases where the commit used
      to have the TOPOSORT flag.
      
      This is the same behavior as before, since indegree could not be
      non-zero when TOPOSORT was unset.
      
      Incidentally, this fixes the bug in show-branch where the 8th column
      was not shown: show-branch sorts the commits in topological order,
      assuming that all the commit flags are available for show-branch's
      private matters.
      
      But this was not true: TOPOSORT was identical to the flag corresponding
      to the 8th ref.  So the flags for the 8th column were unset by the
      topological sorting.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e358f3c3
  13. 10 7月, 2008 1 次提交
  14. 09 7月, 2008 1 次提交
  15. 06 7月, 2008 1 次提交
  16. 04 7月, 2008 1 次提交
  17. 06 5月, 2008 2 次提交
  18. 13 4月, 2008 1 次提交
  19. 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
  20. 19 2月, 2008 1 次提交
  21. 14 2月, 2008 1 次提交
    • 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
  22. 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
  23. 14 11月, 2007 1 次提交
    • 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
  24. 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
  25. 04 11月, 2007 2 次提交
    • 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
    • L
      Simplify topo-sort logic · 23c17d4a
      Linus Torvalds 提交于
      .. by not using quite so much indirection.
      
      This currently grows the "struct commit" a bit, which could be avoided by
      using a union for "util" and "indegree" (the topo-sort used to use "util"
      anyway, so you cannot use them together), but for now the goal of this was
      to simplify, not optimize.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      23c17d4a
  26. 14 8月, 2007 1 次提交
  27. 08 6月, 2007 1 次提交
  28. 06 5月, 2007 1 次提交
  29. 26 4月, 2007 1 次提交
    • J
      Add --date={local,relative,default} · a7b02ccf
      Junio C Hamano 提交于
      This adds --date={local,relative,default} option to log family of commands,
      to allow displaying timestamps in user's local timezone, relative time, or
      the default format.
      
      Existing --relative-date option is a synonym of --date=relative; we could
      probably deprecate it in the long run.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      a7b02ccf
  30. 24 4月, 2007 1 次提交