1. 30 Jan, 2017 1 commit
    • René Scharfe's avatar
      use SWAP macro · 35d803bc
      René Scharfe authored
      Apply the semantic patch swap.cocci to convert hand-rolled swaps to use
      the macro SWAP.  The resulting code is shorter and easier to read, the
      object code is effectively unchanged.
      
      The patch for object.c had to be hand-edited in order to preserve the
      comment before the change; Coccinelle tried to eat it for some reason.
      Signed-off-by: default avatarRene Scharfe <l.s.r@web.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      35d803bc
  2. 06 Aug, 2013 5 commits
  3. 05 Aug, 2013 2 commits
  4. 18 Jul, 2013 1 commit
    • Eric Sunshine's avatar
      line-range: fix "blame -L X,-N" regression · 3bf65f9e
      Eric Sunshine authored
      "blame -L X,-N" is documented as blaming "N lines ending at X".  In
      practice, the behavior is achieved by swapping the two range endpoints
      if the second is less than the first.  25ed3412 (Refactor parse_loc;
      2013-03-28) broke this interpretation by removing the swapping code from
      blame.c and failing to add it to line-range.c along with other code
      relocated from blame.c. Thus, such a range is effectively treated as
      empty.  Fix this regression.
      Signed-off-by: Eric Sunshine's avatarEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      3bf65f9e
  5. 28 Mar, 2013 3 commits
    • Thomas Rast's avatar
      log -L: :pattern:file syntax to find by funcname · 13b8f68c
      Thomas Rast authored
      This new syntax finds a funcname matching /pattern/, and then takes from there
      up to (but not including) the next funcname.  So you can say
      
        git log -L:main:main.c
      
      and it will dig up the main() function and show its line-log, provided
      there are no other funcnames matching 'main'.
      Signed-off-by: default avatarThomas Rast <trast@student.ethz.ch>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      13b8f68c
    • Thomas Rast's avatar
      Implement line-history search (git log -L) · 12da1d1f
      Thomas Rast authored
      This is a rewrite of much of Bo's work, mainly in an effort to split
      it into smaller, easier to understand routines.
      
      The algorithm is built around the struct range_set, which encodes a
      series of line ranges as intervals [a,b).  This is used in two
      contexts:
      
      * A set of lines we are tracking (which will change as we dig through
        history).
      * To encode diffs, as pairs of ranges.
      
      The main routine is range_set_map_across_diff().  It processes the
      diff between a commit C and some parent P.  It determines which diff
      hunks are relevant to the ranges tracked in C, and computes the new
      ranges for P.
      
      The algorithm is then simply to process history in topological order
      from newest to oldest, computing ranges and (partial) diffs.  At
      branch points, we need to merge the ranges we are watching.  We will
      find that many commits do not affect the chosen ranges, and mark them
      TREESAME (in addition to those already filtered by pathspec limiting).
      Another pass of history simplification then gets rid of such commits.
      
      This is wired as an extra filtering pass in the log machinery.  This
      currently only reduces code duplication, but should allow for other
      simplifications and options to be used.
      
      Finally, we hook a diff printer into the output chain.  Ideally we
      would wire directly into the diff logic, to optionally use features
      like word diff.  However, that will require some major reworking of
      the diff chain, so we completely replace the output with our own diff
      for now.
      
      As this was a GSoC project, and has quite some history by now, many
      people have helped.  In no particular order, thanks go to
      
        Jakub Narebski <jnareb@gmail.com>
        Jens Lehmann <Jens.Lehmann@web.de>
        Jonathan Nieder <jrnieder@gmail.com>
        Junio C Hamano <gitster@pobox.com>
        Ramsay Jones <ramsay@ramsay1.demon.co.uk>
        Will Palmer <wmpalmer@gmail.com>
      
      Apologies to everyone I forgot.
      Signed-off-by: default avatarBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: default avatarThomas Rast <trast@student.ethz.ch>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      12da1d1f
    • Bo Yang's avatar
      Refactor parse_loc · 25ed3412
      Bo Yang authored
      We want to use the same style of -L n,m argument for 'git log -L' as
      for git-blame.  Refactor the argument parsing of the range arguments
      from builtin/blame.c to the (new) file that will hold the 'git log -L'
      logic.
      
      To accommodate different data structures in blame and log -L, the file
      contents are abstracted away; parse_range_arg takes a callback that it
      uses to get the contents of a line of the (notional) file.
      
      The new test is for a case that made me pause during debugging: the
      'blame -L with invalid end' test was the only one that noticed an
      outright failure to parse the end *at all*.  So make a more explicit
      test for that.
      Signed-off-by: default avatarBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: default avatarThomas Rast <trast@student.ethz.ch>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      25ed3412